seperate regular

This commit is contained in:
2023-04-26 23:19:42 +08:00
parent 6d2c0d8cb3
commit 89124b9ad9
7 changed files with 71 additions and 10 deletions

View File

@@ -36,10 +36,12 @@ class Store {
class HTML {
html: string;
constructor() {
filename: string;
constructor(filename: string) {
this.filename = filename;
// load from file
try {
this.html = fs.readFileSync("./html.html", "utf8");
this.html = fs.readFileSync(this.filename, "utf8");
} catch {
this.html = "";
}
@@ -50,10 +52,11 @@ class HTML {
public async set(html: string) {
this.html = html;
// store into file
await write("./html.html", html, "utf8");
await write(this.filename, html, "utf8");
}
}
export const html = new HTML();
export const store = new Store("store.json");
export const regular = new Store("regular.json");
export const html = new HTML("./data/html.html");
export const htmlRegular = new HTML("./data/html-regular.html");
export const store = new Store("./data/store.json");
export const regular = new Store("./data/regular.json");