make gulp better for static
This commit is contained in:
parent
ef2e3f242f
commit
a69b8c552f
3 changed files with 14 additions and 17 deletions
12
gulpfile.cjs
12
gulpfile.cjs
|
@ -60,7 +60,11 @@ gulp.task("scripts", async () => {
|
||||||
.pipe(gulp.dest("dist"));
|
.pipe(gulp.dest("dist"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
gulp.task("commit", () => {
|
||||||
|
revision = require("child_process").execSync("git rev-parse HEAD").toString().trim();
|
||||||
|
fs.writeFileSync("dist/webpage/getupdates", revision);
|
||||||
|
return new Promise((_) => _());
|
||||||
|
});
|
||||||
// Task to copy HTML files
|
// Task to copy HTML files
|
||||||
gulp.task("copy-html", () => {
|
gulp.task("copy-html", () => {
|
||||||
return gulp
|
return gulp
|
||||||
|
@ -114,5 +118,9 @@ gulp.task("copy-assets", () => {
|
||||||
// Default task to run all tasks
|
// Default task to run all tasks
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"default",
|
"default",
|
||||||
gulp.series("clean", gulp.parallel("scripts", "copy-html", "copy-assets"), "copy-translations"),
|
gulp.series(
|
||||||
|
"clean",
|
||||||
|
gulp.parallel("scripts", "copy-html", "copy-assets"),
|
||||||
|
gulp.parallel("copy-translations", "commit"),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
10
src/index.ts
10
src/index.ts
|
@ -135,16 +135,6 @@ async function updateInstances(): Promise<void> {
|
||||||
|
|
||||||
updateInstances();
|
updateInstances();
|
||||||
|
|
||||||
app.use("/getupdates", async (_req: Request, res: Response) => {
|
|
||||||
try {
|
|
||||||
const stats = await fs.stat(path.join(__dirname, "webpage"));
|
|
||||||
res.send(stats.mtimeMs.toString());
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error getting updates:", error);
|
|
||||||
res.status(500).send("Error getting updates");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use("/services/oembed", (req: Request, res: Response) => {
|
app.use("/services/oembed", (req: Request, res: Response) => {
|
||||||
inviteResponse(req, res, instances);
|
inviteResponse(req, res, instances);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2117,17 +2117,16 @@ class Localuser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
(async () => {
|
||||||
const jankInfo = settings.addButton(I18n.jankInfo());
|
const jankInfo = settings.addButton(I18n.jankInfo());
|
||||||
const img = document.createElement("img");
|
const img = document.createElement("img");
|
||||||
img.src = "/logo.svg";
|
img.src = "/logo.svg";
|
||||||
jankInfo.addHTMLArea(img);
|
jankInfo.addHTMLArea(img);
|
||||||
img.width = 128;
|
img.width = 128;
|
||||||
img.height = 128;
|
img.height = 128;
|
||||||
jankInfo.addMDText(
|
const ver = await (await fetch("/getupdates")).text();
|
||||||
I18n.clientDesc("Jank-Rolling", window.location.origin, this.rights.allow + ""),
|
jankInfo.addMDText(I18n.clientDesc(ver, window.location.origin, this.rights.allow + ""));
|
||||||
);
|
})();
|
||||||
}
|
|
||||||
settings.show();
|
settings.show();
|
||||||
}
|
}
|
||||||
readonly botTokens: Map<string, string> = new Map();
|
readonly botTokens: Map<string, string> = new Map();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue