forked from unimatrix/web
Add Minecraft-styled website, online manual and DiscordSRV feeds
This commit is contained in:
parent
25f5c5717d
commit
f9667566e2
123 changed files with 398 additions and 4 deletions
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
|
|
@ -7,6 +7,30 @@ on:
|
|||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build-website:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: website
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Build the illustrated website and API
|
||||
run: node scripts/build.mjs
|
||||
- name: Test feeds and compiled pages
|
||||
run: node --test tests/*.test.mjs
|
||||
- name: Upload website build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Project-Dune-Website
|
||||
path: website/dist/
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
|
||||
build-core:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
|
@ -143,6 +167,7 @@ jobs:
|
|||
cp docs/Dune-Complete-Illustrated-Manual.pdf DuneRealms-Server-Package/
|
||||
cp docs/posters/*.png DuneRealms-Server-Package/
|
||||
cp README.md DuneRealms-Server-Package/Project-README.md
|
||||
cp website/DISCORD-FEEDS.md DuneRealms-Server-Package/DiscordSRV-Website-Setup.md
|
||||
cat > DuneRealms-Server-Package/README.txt <<'EOF'
|
||||
DuneRealms Paper server package
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
plugins { java }
|
||||
group = "com.example"
|
||||
version = "1.0.8"
|
||||
version = "1.0.9"
|
||||
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://jitpack.io") }
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ final class ArrakisAnnouncements {
|
|||
DataOutputStream out = new DataOutputStream(bytes);
|
||||
out.writeUTF("Message"); out.writeUTF("ALL"); out.writeUTF(message);
|
||||
carrier.sendPluginMessage(plugin, "BungeeCord", bytes.toByteArray());
|
||||
plugin.websiteNews(message);
|
||||
} catch (IOException ex) { plugin.getLogger().warning("Guild announcement failed: " + ex.getMessage()); continue; }
|
||||
} else Bukkit.broadcastMessage(message);
|
||||
state.set(key + ".sent", true);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package com.example.dunerealms;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.BroadcastMessageEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/** Opt-in publication of public notifications and read-only market snapshots via DiscordSRV. */
|
||||
final class DiscordWebFeed implements Listener {
|
||||
private final DuneCore plugin;
|
||||
private final Gson gson = new GsonBuilder().serializeNulls().create();
|
||||
DiscordWebFeed(DuneCore plugin) { this.plugin = plugin; }
|
||||
void start() {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
Bukkit.getScheduler().runTaskTimer(plugin, this::exchange, 200L, 1200L);
|
||||
}
|
||||
boolean enabled() { return plugin.getConfig().getBoolean("website.discord.enabled", false)
|
||||
&& Bukkit.getPluginManager().isPluginEnabled("DiscordSRV"); }
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void broadcast(BroadcastMessageEvent event) {
|
||||
if (!enabled()) return;
|
||||
String message = event.getMessage();
|
||||
if (event.isAsynchronous()) Bukkit.getScheduler().runTask(plugin, () -> news(message));
|
||||
else news(message);
|
||||
}
|
||||
void news(String message) {
|
||||
if (!enabled()) return;
|
||||
String clean = ChatColor.stripColor(message).replace('\n', ' ').replace('\r', ' ');
|
||||
if (clean.isBlank()) return;
|
||||
String planet = plugin.getConfig().getString("network.local-planet", "arrakis");
|
||||
send("news-channel-id", "[" + planet + "] " + clean.substring(0, Math.min(1600, clean.length())));
|
||||
}
|
||||
private void exchange() {
|
||||
if (!enabled()) return;
|
||||
// Only Arrakis publishes the market, avoiding independent backend snapshots overwriting it.
|
||||
if (!plugin.getConfig().getString("network.local-planet", "arrakis").equalsIgnoreCase("arrakis")) return;
|
||||
try {
|
||||
for (String part : encode(gson.toJson(plugin.websiteExchangeSnapshot()))) send("exchange-channel-id", part);
|
||||
} catch (IOException | IllegalArgumentException ex) {
|
||||
plugin.getLogger().warning("Website exchange snapshot skipped: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
private void send(String key, String content) {
|
||||
String channel = plugin.getConfig().getString("website.discord." + key, "");
|
||||
if (!channel.matches("[0-9]{17,22}")) return;
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "discordsrv broadcast #" + channel + " " + content);
|
||||
}
|
||||
static List<String> encode(String json) throws IOException {
|
||||
byte[] raw = json.getBytes(StandardCharsets.UTF_8);
|
||||
if (raw.length > 2_000_000) throw new IllegalArgumentException("Market exceeds the supported 2 MB snapshot limit");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
try (GZIPOutputStream gzip = new GZIPOutputStream(output)) { gzip.write(raw); }
|
||||
String payload = Base64.getEncoder().encodeToString(output.toByteArray());
|
||||
int parts = (payload.length() + 1699) / 1700;
|
||||
if (parts > 90) throw new IllegalArgumentException("Market exceeds 90 Discord snapshot parts");
|
||||
String id = UUID.randomUUID().toString();
|
||||
List<String> messages = new ArrayList<>();
|
||||
for (int i = 0; i < parts; i++) messages.add("DUNE_EXCHANGE " + id + " " + (i + 1) + "/" + parts + " "
|
||||
+ payload.substring(i * 1700, Math.min((i + 1) * 1700, payload.length())));
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,29 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
|
|||
private ArrakisWater arrakisWater;
|
||||
private ArrakisAnnouncements announcements;
|
||||
private SandwormMobs sandwormMobs;
|
||||
private DiscordWebFeed discordWebFeed;
|
||||
void websiteNews(String message) { if (discordWebFeed != null) discordWebFeed.news(message); }
|
||||
Map<String, Object> websiteExchangeSnapshot() {
|
||||
List<Map<String, Object>> offers = new ArrayList<>();
|
||||
for (Job job : jobs.values()) {
|
||||
String name = Bukkit.getOfflinePlayer(job.owner()).getName();
|
||||
Map<String, Object> offer = new LinkedHashMap<>();
|
||||
offer.put("id", job.owner().toString()); offer.put("type", "contract"); offer.put("item", "Melange Spice");
|
||||
offer.put("owner", name == null ? job.owner().toString() : name);
|
||||
offer.put("quantity", Math.max(0, job.quota() - job.harvested())); offer.put("price", null);
|
||||
offer.put("status", activeWorkers.containsValue(job.owner()) ? "claimed" : "open");
|
||||
offer.put("description", "Player-sponsored harvesting contract. 15% worker / 85% sponsor. Accept in Minecraft.");
|
||||
offers.add(offer);
|
||||
}
|
||||
org.bukkit.plugin.Plugin ess = Bukkit.getPluginManager().getPlugin("DuneEss");
|
||||
double basePrice = ess instanceof JavaPlugin javaPlugin ? javaPlugin.getConfig().getDouble("currency.spice-price", 15) : 15;
|
||||
Map<String, Object> sale = new LinkedHashMap<>();
|
||||
sale.put("id", "standing-spice-sale"); sale.put("type", "sell"); sale.put("item", "Melange Spice");
|
||||
sale.put("owner", "Solaris economy"); sale.put("quantity", null); sale.put("price", basePrice); sale.put("status", "standing");
|
||||
sale.put("description", "Sell tagged spice with /duneess sell. Base price before Imperial bonuses and Trust levy.");
|
||||
offers.add(sale);
|
||||
return Map.of("type", "dune_exchange", "updatedAt", java.time.Instant.now().toString(), "offers", offers);
|
||||
}
|
||||
|
||||
public void announceArrakisEvent(String kind, Location location, String identity) {
|
||||
if (announcements != null) announcements.announce(kind, location, identity);
|
||||
|
|
@ -97,6 +120,8 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
|
|||
catch(Exception ex){getLogger().severe("Shared database required but unavailable: "+ex.getMessage());getServer().getPluginManager().disablePlugin(this);return;}
|
||||
}
|
||||
politics = new Politics(this, selected, economy, sharedDatabase);
|
||||
discordWebFeed = new DiscordWebFeed(this);
|
||||
discordWebFeed.start();
|
||||
arrakisWater = new ArrakisWater(this,economy,politics);
|
||||
Bukkit.getPluginManager().registerEvents(arrakisWater,this);
|
||||
serverJobs = new ServerJobs(this, economy);
|
||||
|
|
|
|||
|
|
@ -62,3 +62,8 @@ database:
|
|||
password: "CHANGE_ME"
|
||||
|
||||
# NPC settings are now managed by DuneNPC/config.yml.
|
||||
website:
|
||||
discord:
|
||||
enabled: false
|
||||
exchange-channel-id: ""
|
||||
news-channel-id: ""
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
name: DuneCore
|
||||
version: 1.0.8
|
||||
version: 1.0.9
|
||||
main: com.example.dunerealms.DuneCore
|
||||
api-version: '1.21'
|
||||
depend: [Vault, DuneEss]
|
||||
softdepend: [DuneTerrain]
|
||||
softdepend: [DuneTerrain, DiscordSRV]
|
||||
description: Dune factions, Arrakis gameplay, politics, and server mechanics
|
||||
commands:
|
||||
dune:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.example.dunerealms;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Random;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class DiscordWebFeedTest {
|
||||
@Test void multipartMessagesRoundTripWithoutExceedingDiscordLimit() throws Exception {
|
||||
StringBuilder json = new StringBuilder("{\"offers\":\"");
|
||||
Random random = new Random(7);
|
||||
for (int i = 0; i < 15000; i++) json.append((char)('a' + random.nextInt(26)));
|
||||
json.append("\"}");
|
||||
var messages = DiscordWebFeed.encode(json.toString());
|
||||
assertTrue(messages.size() > 1);
|
||||
StringBuilder payload = new StringBuilder();
|
||||
String snapshotId = null;
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
String message = messages.get(i);
|
||||
assertTrue(message.length() < 2000);
|
||||
String[] fields = message.split(" ", 4);
|
||||
assertEquals("DUNE_EXCHANGE", fields[0]);
|
||||
if (snapshotId == null) snapshotId = fields[1];
|
||||
assertEquals(snapshotId, fields[1]);
|
||||
assertEquals((i + 1) + "/" + messages.size(), fields[2]);
|
||||
payload.append(fields[3]);
|
||||
}
|
||||
try (var gzip = new GZIPInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(payload.toString())))) {
|
||||
assertEquals(json.toString(), new String(gzip.readAllBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
@Test void oversizedPublicationIsRejected() {
|
||||
assertThrows(IllegalArgumentException.class, () -> DiscordWebFeed.encode("x".repeat(2_000_001)));
|
||||
}
|
||||
}
|
||||
|
|
@ -4,13 +4,15 @@
|
|||
|
||||
A Dune-themed Minecraft Java plugin suite for **Paper 1.21.4 and Java 21**. Explore Arrakis, harvest melange, join a faction, trade through the Spacing Guild, and encounter Shai-Hulud.
|
||||
|
||||
**[Project Dune website](https://project-dune.bonnystoat9.chatgpt.site)** — illustrated landing page, searchable online manual, Races & Houses, Exchange and News. The Site currently requires owner access through ChatGPT. Live feeds show “server not connected” until configured; see [DiscordSRV integration](website/DISCORD-FEEDS.md).
|
||||
|
||||
**[Read the illustrated user manual](docs/Dune-User-Manual.pdf)** for the complete player and administrator guide, command reference, default configuration, 77 pages, 68 illustrated item and interface icons, ornate Minecraft-inspired House and spice backgrounds, and reserved chapters for the other planets.
|
||||
|
||||
## Current modules
|
||||
|
||||
| Module | Version | Role |
|
||||
| --- | --- | --- |
|
||||
| DuneCore | 1.0.8 | Factions, stillsuits, sandworms, spice harvesting, sun exposure, water, politics, jobs, menus, and Guild announcements. |
|
||||
| DuneCore | 1.0.9 | Factions, stillsuits, sandworms, spice harvesting, sun exposure, water, politics, jobs, menus, Guild announcements, and optional DiscordSRV website feeds. |
|
||||
| DuneTerrain | 1.0.7 | Planet generation, Arrakis formations and landmarks, spice deposits, personal sietch caches, and safe spawn. |
|
||||
| DuneNPC | 1.0.0 | Guild Navigators, smuggler missions, stationary quest camps, timed deadlines, particles and NPC admin GUI. |
|
||||
| DuneEss | 1.0.1 | Solaris economy through Vault, spice sales, Guild travel, help, and administrative travel/economy tools. |
|
||||
|
|
@ -39,6 +41,7 @@ For a planet used as Paper's primary world, configure its generator and biome pr
|
|||
- Operator-only Imperial Admin Scepters, automatically supplied to ops, with linked DuneNPC management controls.
|
||||
- Roaming Arrakis smugglers with lore-based spice and water missions, a 30-minute real-time deadline, stationary illuminated quest camps and green/purple status particles.
|
||||
- A 33% gross spice-sale bonus for Imperial appointees; those appointees use basic spice sales instead of smuggler missions.
|
||||
- An opt-in DiscordSRV bridge for public announcements and read-only Arrakis exchange snapshots. Publication is disabled by default; the website never executes trades or accepts jobs.
|
||||
|
||||
The other planet terrain profiles already exist: Giedi Prime, Kaitain, Caladan, and Sigma Draconis IV. Their dedicated manual chapters reserve space for future planet-specific gameplay rather than describing unreleased quests or cities.
|
||||
|
||||
|
|
@ -92,6 +95,8 @@ The existing workflow builds all four project modules and produces the downloada
|
|||
- [Worlds and mechanics poster](docs/posters/Dune-Illustrated-Worlds-and-Mechanics-Poster.png)
|
||||
- [Editable manual sources](docs/manual-authoring/README.md)
|
||||
- [DuneNPC commands and mission mechanics](DuneNPC/README.md)
|
||||
- [Website source and build](website/README.md)
|
||||
- [DiscordSRV exchange/news feed setup](website/DISCORD-FEEDS.md)
|
||||
- [Session 2 changes](SESSION-2.md)
|
||||
- [DuneTerrain setup](DuneTerrain/README.md)
|
||||
- [DuneCore details](DuneRealms-minecraft-only/README.md)
|
||||
|
|
|
|||
7
docs/artwork/MINECRAFT-WEBSITE-ARTWORK.md
Normal file
7
docs/artwork/MINECRAFT-WEBSITE-ARTWORK.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Minecraft redesign artwork
|
||||
|
||||
Mode: built-in image generation. New landscape voxel illustration used as `web/assets/minecraft-hero.webp`; source PNG retained in the project artwork archive. Existing manual artwork supplies the sietch, Guild and smuggler panels, planet scenes, 68 item icons and ornamental page backgrounds.
|
||||
|
||||
Prompt direction: a wide 16:9 cinematic Minecraft voxel illustration of Arrakis at orange sunset. Crisp cuboid geometry and pixel-textured surfaces; tan stillsuit adventurer with netherite shovel, blue Atreides companion, glowing spice blocks, flat rock terraces, a sietch entrance, Guild camp, far-distance block-built sandworm and spice harvester. Leave the left half atmospheric for text; concentrate figures on the right. Melange gold, sandstone, dark teal, emerald and House-blue details. No text, watermark, interface or logos.
|
||||
|
||||
The illustration represents Dune themes, not an in-game screenshot or a promise that concept buildings generate in the plugin. Minecraft-style inventory panels link to the actual equipment chapters.
|
||||
BIN
docs/artwork/minecraft-website-hero.png
Normal file
BIN
docs/artwork/minecraft-website-hero.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 MiB |
6
website/.env.example
Normal file
6
website/.env.example
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Configure these values as server-side Sites environment variables.
|
||||
# Never put a real bot token into this file or browser JavaScript.
|
||||
DISCORD_BOT_TOKEN=
|
||||
DISCORD_PUBLISHER_ID=
|
||||
DISCORD_EXCHANGE_CHANNEL_ID=
|
||||
DISCORD_NEWS_CHANNEL_ID=
|
||||
5
website/.gitignore
vendored
Normal file
5
website/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
node_modules/
|
||||
dist/
|
||||
5
website/.openai/hosting.json
Normal file
5
website/.openai/hosting.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"project_id": "appgprj_6ace145fede88191b193de34d1753c02",
|
||||
"d1": null,
|
||||
"r2": null
|
||||
}
|
||||
77
website/DISCORD-FEEDS.md
Normal file
77
website/DISCORD-FEEDS.md
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# DiscordSRV website feeds
|
||||
|
||||
The site is currently unconnected. No bot token or channel IDs have been supplied. Exchange and News display that state; they do not contain invented live records.
|
||||
|
||||
## Minecraft publisher
|
||||
|
||||
Install DuneCore 1.0.9 and DiscordSRV alongside the existing plugin suite. Create dedicated Discord text channels for exchange snapshots and public game news. Do not use a console-log or private-chat channel.
|
||||
|
||||
Set the following in `plugins/DuneCore/config.yml`, then restart:
|
||||
|
||||
```yaml
|
||||
website:
|
||||
discord:
|
||||
enabled: true
|
||||
exchange-channel-id: "YOUR_EXCHANGE_CHANNEL_ID"
|
||||
news-channel-id: "YOUR_NEWS_CHANNEL_ID"
|
||||
```
|
||||
|
||||
The bridge invokes the supported `discordsrv broadcast #ChannelID Message` command from the server console. DiscordSRV retains the sending bot credential. The bridge sends public Bukkit broadcast events, plus the delayed cross-server Guild notice after the plugin-message delivery request succeeds. It does not intercept player private messages or publish console logs. Notifications are prefixed with the backend planet. Configure the news channel on each backend whose public broadcasts you want published.
|
||||
|
||||
Only Arrakis publishes exchange snapshots, every 60 seconds. They contain all current local player harvesting contracts (remaining quota and open/claimed state) and the standing ordinary spice sale from DuneEss's configured base price. The current plugin does not implement a general player item buy/sell order book. The website identifies harvesting contracts separately and accepts buy/sell entries in the API schema for future offer systems.
|
||||
|
||||
Publication is disabled by default and changes no trade, NPC, timer or economy behavior. Existing configuration files are preserved; add the new section when enabling the bridge.
|
||||
|
||||
## Website reader
|
||||
|
||||
Use the Sites environment-variable settings to configure:
|
||||
|
||||
| Variable | Purpose |
|
||||
| --- | --- |
|
||||
| `DISCORD_BOT_TOKEN` | Server-only token for a bot allowed to read the dedicated feed channels. |
|
||||
| `DISCORD_PUBLISHER_ID` | Discord user ID of the DiscordSRV publishing bot; messages from every other author are ignored. |
|
||||
| `DISCORD_EXCHANGE_CHANNEL_ID` | The exchange channel configured on Arrakis. |
|
||||
| `DISCORD_NEWS_CHANNEL_ID` | The public game news channel. |
|
||||
|
||||
The reader bot needs View Channel and Read Message History permissions, and the message-content access required by Discord. The DiscordSRV publisher needs Send Messages. Do not put the token in source, HTML, JavaScript assets, URLs or the hosting manifest. The published Site keeps its existing private audience.
|
||||
|
||||
## API routes and freshness
|
||||
|
||||
- `GET /api/exchange`: complete, author-verified exchange snapshot. Rejects partial/malformed snapshots and records older than five minutes. Returns `not_connected` until configured, or `awaiting_snapshot` if no current snapshot exists.
|
||||
- `GET /api/news?before=DISCORD_MESSAGE_ID`: newest public news records. Fetches up to 100 Discord messages per page, exposes a cursor for older history, and filters to the configured publishing bot. Discord channel retention bounds available history.
|
||||
- Both routes cache Discord channel reads in the Worker for 60 seconds, honor upstream failures with an unavailable state, and never return credentials. They perform read-only Discord requests.
|
||||
|
||||
An exchange snapshot is UTF-8 JSON, gzip-compressed and base64-encoded. Split it into payload chunks no longer than 1700 characters. Each Discord message has the format:
|
||||
|
||||
```text
|
||||
DUNE_EXCHANGE unique-snapshot-id 1/2 base64-payload-part
|
||||
```
|
||||
|
||||
All parts share the same snapshot ID and total count. The API assembles the newest complete snapshot regardless of Discord message order. Maximum 90 parts and 2 MB decompressed data. Large unsupported markets are skipped with a server warning rather than silently truncated.
|
||||
|
||||
Decoded schema:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "dune_exchange",
|
||||
"updatedAt": "ISO-8601 UTC timestamp",
|
||||
"offers": [{
|
||||
"id": "stable-offer-id",
|
||||
"type": "buy, sell, or contract",
|
||||
"item": "Melange Spice",
|
||||
"owner": "Minecraft player name or UUID",
|
||||
"quantity": 64,
|
||||
"price": null,
|
||||
"status": "open, claimed, standing, or closed",
|
||||
"description": "Human-readable offer details"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
`quantity: null` means a standing offer; `price: null` means a harvesting-contract split rather than a unit price. Trades happen in Minecraft. The website cannot accept jobs, spend Solaris or move items.
|
||||
|
||||
## Validation
|
||||
|
||||
Run `node --test tests/feed-api.test.mjs` for unconnected state, multipart assembly, author filtering, partial/stale rejection and malformed offer validation. Run the Core Gradle tests for publisher encoding and existing gameplay regressions. Live DiscordSRV delivery requires a running server and configured channels.
|
||||
|
||||
Primary references: [DiscordSRV broadcast command](https://docs.discordsrv.com/commands/), [Discord Get Channel Messages](https://github.com/discord/discord-api-docs/blob/main/developers/resources/message.mdx), [Discord permissions](https://github.com/discord/discord-api-docs/blob/main/developers/topics/permissions.mdx).
|
||||
7
website/MINECRAFT-ARTWORK.md
Normal file
7
website/MINECRAFT-ARTWORK.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Minecraft redesign artwork
|
||||
|
||||
Mode: built-in image generation. New landscape voxel illustration used as `web/assets/minecraft-hero.webp`; source PNG retained in the project artwork archive. Existing manual artwork supplies the sietch, Guild and smuggler panels, planet scenes, 68 item icons and ornamental page backgrounds.
|
||||
|
||||
Prompt direction: a wide 16:9 cinematic Minecraft voxel illustration of Arrakis at orange sunset. Crisp cuboid geometry and pixel-textured surfaces; tan stillsuit adventurer with netherite shovel, blue Atreides companion, glowing spice blocks, flat rock terraces, a sietch entrance, Guild camp, far-distance block-built sandworm and spice harvester. Leave the left half atmospheric for text; concentrate figures on the right. Melange gold, sandstone, dark teal, emerald and House-blue details. No text, watermark, interface or logos.
|
||||
|
||||
The illustration represents Dune themes, not an in-game screenshot or a promise that concept buildings generate in the plugin. Minecraft-style inventory panels link to the actual equipment chapters.
|
||||
11
website/README.md
Normal file
11
website/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Project Dune website
|
||||
|
||||
A responsive website styled from the illustrated plugin manual. Includes Arrakis gameplay, accessible House/planet tabs, DuneNPC missions, administrator tools, downloads and installation instructions. Separate pages provide the 57-chapter browsable manual with all 68 illustrated icons, Races & Houses, Exchange and News.
|
||||
|
||||
Browser files are in `web/`. The server-only Discord API is in `worker/feed-api.mjs`. Hosting configuration is in `.openai/hosting.json`. `node scripts/build.mjs` creates a Worker ESM bundle with the website assets embedded, avoiding separate asset bindings. No dependency installation is required.
|
||||
|
||||
Run `node scripts/preview.mjs` for the local site and honest unconnected feed responses. Run `node --test tests/feed-api.test.mjs` for API transport and validation checks. Site publishing uses the supported Sites source workflow and packaging helpers.
|
||||
|
||||
See [DiscordSRV feed setup](DISCORD-FEEDS.md) for the optional DuneCore 1.0.9 bridge, required server-side secret names, channel setup and snapshot protocol. No credentials are committed or delivered to the browser. Feed data is read-only; trades stay inside Minecraft.
|
||||
|
||||
Art is reused from the Project Dune manual and optimized into WebP. Concept-art claims are identified on the page. No game server address or live market records are invented. The website retains the Site's owner-private audience until changed explicitly.
|
||||
1
website/package.json
Normal file
1
website/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"name":"project-dune-website","private":true,"type":"module","scripts":{"build":"node scripts/build.mjs","test":"node --test tests/feed-api.test.mjs"}}
|
||||
7
website/scripts/build.mjs
Normal file
7
website/scripts/build.mjs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import {readFileSync,writeFileSync,readdirSync,statSync,mkdirSync,existsSync,rmSync,cpSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url';
|
||||
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'),web=path.join(root,'web'),dist=path.join(root,'dist');
|
||||
const assets={};const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.svg':'image/svg+xml'};
|
||||
function collect(directory){for(const entry of readdirSync(directory)){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);assets['/'+path.relative(web,p).split(path.sep).join('/')]=[type,readFileSync(p).toString('base64')]}}}collect(web);
|
||||
let api=readFileSync(path.join(root,'worker/feed-api.mjs'),'utf8').replace(/export /g,'');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace("import {handleFeed} from './feed-api.mjs';",'');
|
||||
if(existsSync(dist)){const resolved=path.resolve(dist);if(resolved!==path.join(root,'dist'))throw Error('Invalid dist directory');rmSync(resolved,{recursive:true,force:true})}
|
||||
mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});writeFileSync(path.join(dist,'server/index.js'),'const ASSET_DATA='+JSON.stringify(assets)+';\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',Object.keys(assets).length,'embedded website assets');
|
||||
3
website/scripts/preview.mjs
Normal file
3
website/scripts/preview.mjs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import {createServer} from 'node:http';import {readFileSync,existsSync,statSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url';import {handleFeed} from '../worker/feed-api.mjs';
|
||||
const web=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'../web');const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.svg':'image/svg+xml'};
|
||||
createServer(async(req,res)=>{try{const url=new URL(req.url,'http://127.0.0.1:8765');if(url.pathname.startsWith('/api/')){const response=await handleFeed(new Request(url,{method:req.method}),{});res.writeHead(response.status,Object.fromEntries(response.headers));res.end(Buffer.from(await response.arrayBuffer()));return}const pathname=decodeURIComponent(url.pathname==='/'?'/index.html':url.pathname);const file=path.resolve(web,'.'+pathname);if(!file.startsWith(web+path.sep)||!existsSync(file)||!statSync(file).isFile()){res.writeHead(404);res.end('Not found');return}res.writeHead(200,{'Content-Type':types[path.extname(file)]||'application/octet-stream'});res.end(readFileSync(file))}catch{res.writeHead(500);res.end('Preview error')}}).listen(8765,'127.0.0.1',()=>console.log('Dune website: http://127.0.0.1:8765'));
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue

Staff