Credits page
This commit is contained in:
@@ -180,7 +180,12 @@ async function build_mods(mods: LoadedMod[], atlas: AtlasListing) {
|
||||
const index: ServerModIndex = { atlas, mods: [] };
|
||||
|
||||
for (const mod of mods) {
|
||||
const manifest = mod.manifest as { name: string; version: string; scripts?: Record<string, string> };
|
||||
const manifest = mod.manifest as {
|
||||
name: string;
|
||||
version: string;
|
||||
scripts?: Record<string, string>;
|
||||
credits?: string;
|
||||
};
|
||||
const scripts = manifest.scripts ?? {};
|
||||
|
||||
const data: ModData = {
|
||||
@@ -196,7 +201,9 @@ async function build_mods(mods: LoadedMod[], atlas: AtlasListing) {
|
||||
: undefined;
|
||||
const server = scripts.server ? await bundle_script(`${mod.dir}/${scripts.server}`, "deno") : undefined;
|
||||
|
||||
const hash = await short_hash([data_json, client ?? "", worldgen ?? ""]);
|
||||
const credits = manifest.credits ? Deno.readTextFileSync(`${mod.dir}/${manifest.credits}`) : undefined;
|
||||
|
||||
const hash = await short_hash([data_json, client ?? "", worldgen ?? "", credits ?? ""]);
|
||||
const public_dir = `mods/${mod.id}/${hash}`;
|
||||
Deno.mkdirSync(`${BUILD_FOLDER}/${public_dir}`, { recursive: true });
|
||||
|
||||
@@ -219,6 +226,11 @@ async function build_mods(mods: LoadedMod[], atlas: AtlasListing) {
|
||||
listing.sha256.worldgen = await sha256(worldgen);
|
||||
Deno.writeTextFileSync(`${BUILD_FOLDER}/${listing.worldgen}`, worldgen);
|
||||
}
|
||||
if (credits !== undefined) {
|
||||
listing.credits = `${public_dir}/credits.md`;
|
||||
listing.sha256.credits = await sha256(credits);
|
||||
Deno.writeTextFileSync(`${BUILD_FOLDER}/${listing.credits}`, credits);
|
||||
}
|
||||
|
||||
const entry: ServerModIndex["mods"][number] = { listing };
|
||||
if (server) {
|
||||
|
||||
Reference in New Issue
Block a user