mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-20 05:30:59 -04:00
Show push example under the detail page (#3739)
This commit is contained in:
parent
bef6a7911f
commit
98b93c887a
18 changed files with 249 additions and 23 deletions
|
@ -4,6 +4,8 @@ const { sendInfo } = require("../client");
|
|||
const { checkLogin } = require("../util-server");
|
||||
const GameResolver = require("gamedig/lib/GameResolver");
|
||||
const { testChrome } = require("../monitor-types/real-browser-monitor-type");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
let gameResolver = new GameResolver();
|
||||
let gameList = null;
|
||||
|
@ -62,4 +64,29 @@ module.exports.generalSocketHandler = (socket, server) => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("getPushExample", (language, callback) => {
|
||||
|
||||
try {
|
||||
let dir = path.join("./extra/push-examples", language);
|
||||
let files = fs.readdirSync(dir);
|
||||
|
||||
for (let file of files) {
|
||||
if (file.startsWith("index.")) {
|
||||
callback({
|
||||
ok: true,
|
||||
code: fs.readFileSync(path.join(dir, file), "utf8"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
callback({
|
||||
ok: false,
|
||||
msg: "Not found",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue