Merge pull request #98 from rajnandan1/release/0.0.15

Release/0.0.15
This commit is contained in:
Raj Nandan Sharma
2024-08-11 07:37:33 -07:00
committed by GitHub
29 changed files with 144 additions and 55 deletions

View File

@@ -40,3 +40,5 @@ i18n:
hi: "हिन्दी"
zh-CN: "中文"
ja: "日本語"
vi: "Tiếng Việt"
theme: dark

View File

@@ -32,7 +32,7 @@
"today": "आज",
"uptime": "अपटाइम"
},
"numbers": ["", "", "", "", "", "", "", "", "", ""],
"numbers": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
"root": {
"active_incidents": "सक्रिय घटनाएं",
"availability_per_component": "प्रति कॉम्पोनेन्ट उपलब्धता",

57
locales/vi.json Normal file
View File

@@ -0,0 +1,57 @@
{
"root": {
"ongoing_incidents": "Sự Cố Đang Xảy Ra",
"availability_per_component": "Độ Sẵn Sàng Của Từng Thành Phần",
"other_monitors": "Các Giám Sát Khác",
"no_monitors": "Không tìm thấy giám sát nào",
"read_doc_monitor": "Đọc tài liệu để thêm giám sát đầu tiên của bạn",
"here": "tại đây",
"category": "Danh Mục",
"incident": "Sự Cố",
"incidents": "Các Sự Cố",
"no_recent_incident": "Không có sự cố gần đây",
"recent_incidents": "Các Sự Cố Gần Đây",
"active_incidents": "Các Sự Cố Đang Hoạt Động",
"no_active_incident": "Không Có Sự Cố Đang Hoạt Động",
"last_x_hours": "Trong %hours giờ qua"
},
"statuses": {
"UP": "HOẠT ĐỘNG",
"DOWN": "NGỪNG HOẠT ĐỘNG",
"DEGRADED": "SUY GIẢM"
},
"incident": {
"identified": "Đã Xác Định",
"resolved": "Đã Giải Quyết",
"maintenance": "Bảo Trì"
},
"monitor": {
"share": "Chia Sẻ",
"badge": "Huy Hiệu",
"embed": "Nhúng",
"mode": "Chế Độ",
"status": "Trạng Thái",
"copied": "Đã Sao Chép",
"uptime": "Thời Gian Hoạt Động",
"theme": "Chủ Đề",
"theme_light": "Sáng",
"theme_dark": "Tối",
"today": "Hôm Nay",
"90_day": "90 Ngày",
"share_desc": "Chia sẻ giám sát này bằng một liên kết với người khác",
"badge_desc": "Nhận huy hiệu SVG cho giám sát này",
"embed_desc": "Nhúng giám sát này bằng <script> hoặc <iframe> vào ứng dụng của bạn.",
"cp_link": "Sao Chép Liên Kết",
"cpd_link": "Liên Kết Đã Được Sao Chép",
"cp_code": "Sao Chép Mã",
"cpd_code": "Mã Đã Được Sao Chép",
"status_x_minute": "%status trong %minute phút",
"status_x_minutes": "%status trong %minutes phút",
"status_x_hour_y_minute": "%status trong %hours giờ và %minutes phút",
"status_no_data": "Không Có Dữ Liệu",
"status_ok": "Trạng Thái OK",
"am": "sáng",
"pm": "chiều"
},
"numbers": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
}

22
package-lock.json generated
View File

@@ -14,6 +14,7 @@
"bits-ui": "^0.9.9",
"clsx": "^2.0.0",
"croner": "^7.0.5",
"dotenv": "^16.4.5",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"js-yaml": "^4.1.0",
@@ -1190,9 +1191,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001565",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001565.tgz",
"integrity": "sha512-xrE//a3O7TP0vaJ8ikzkD2c2NgcVUvsEe2IvFTntV4Yd1Z9FVzh+gW+enX96L0psrbaFMcVcH2l90xNuGDWc8w==",
"version": "1.0.30001651",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz",
"integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==",
"dev": true,
"funding": [
{
@@ -1207,7 +1208,8 @@
"type": "github",
"url": "https://github.com/sponsors/ai"
}
]
],
"license": "CC-BY-4.0"
},
"node_modules/chalk": {
"version": "4.1.2",
@@ -1627,6 +1629,18 @@
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="
},
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "kener",
"version": "0.0.14",
"version": "0.0.15",
"private": false,
"license": "MIT",
"description": "Kener: An open-source Node.js status page application for real-time service monitoring, incident management, and customizable reporting. Simplify service outage tracking, enhance incident communication, and ensure a seamless user experience.",
@@ -61,6 +61,7 @@
"bits-ui": "^0.9.9",
"clsx": "^2.0.0",
"croner": "^7.0.5",
"dotenv": "^16.4.5",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"js-yaml": "^4.1.0",

View File

@@ -1,6 +1,7 @@
import { FOLDER, FOLDER_MONITOR, FOLDER_SITE, ENV } from "./constants.js";
import { IsStringURLSafe } from "./tool.js";
import dotenv from "dotenv";
dotenv.config();
import fs from "fs-extra";
let STATUS_OK = false;
if (!!process.env.PUBLIC_KENER_FOLDER) {

View File

@@ -1,4 +1,6 @@
// Define your constants
import dotenv from "dotenv";
dotenv.config();
const FOLDER = process.env.PUBLIC_KENER_FOLDER;
const ENV = process.env.NODE_ENV;
const MONITOR = "./config/monitors.yaml";

View File

@@ -10,6 +10,8 @@ import {
import { GetIncidents, GetEndTimeFromBody, GetStartTimeFromBody, CloseIssue } from "./github.js";
import Randomstring from "randomstring";
import Queue from "queue";
import dotenv from "dotenv";
dotenv.config();
const Kener_folder = process.env.PUBLIC_KENER_FOLDER;
const apiQueue = new Queue({
@@ -103,17 +105,15 @@ function replaceAllOccurrences(originalString, searchString, replacement) {
return replacedString;
}
const pingCall = async (hostsV4, hostsV6) => {
let alive = true;
let latencyTotal = 0;
let countHosts = hostsV4.length + hostsV6.length;
for (let i = 0; i < hostsV4.length; i++) {
const host = hostsV4[i].trim();
try {
let res = await ping.promise.probe(host);
alive = alive && res.alive;
alive = alive && res.alive;
latencyTotal += res.time;
} catch (error) {
alive = alive && false;
@@ -140,7 +140,7 @@ const pingCall = async (hostsV4, hostsV6) => {
latency: parseInt(latencyTotal / countHosts),
type: "realtime"
};
}
};
const apiCall = async (envSecrets, url, method, headers, body, timeout, monitorEval) => {
let axiosHeaders = {};
axiosHeaders["User-Agent"] = "Kener/0.0.1";
@@ -345,7 +345,7 @@ const Minuter = async (envSecrets, monitor, githubConfig) => {
let pingResponse = await pingCall(monitor.ping.hostsV4, monitor.ping.hostsV6);
pingData[startOfMinute] = pingResponse;
}
webhookData = await getWebhookData(monitor);
manualData = await manualIncident(monitor, githubConfig);
//merge noData, apiData, webhookData, dayData

View File

@@ -2,6 +2,10 @@
import axios from "axios";
import { GetMinuteStartNowTimestampUTC } from "./tool.js";
import { marked } from "marked";
import { fileURLToPath } from "url";
import { dirname } from "path";
import dotenv from "dotenv";
dotenv.config();
const GH_TOKEN = process.env.GH_TOKEN;
const GhnotconfireguredMsg =
"owner or repo or GH_TOKEN is undefined. Read the docs to configure github: https://kener.ing/docs#h2github-setup";

View File

@@ -3,6 +3,8 @@
// create sitemap.xml
import fs from "fs-extra";
let siteMap = "";
import dotenv from "dotenv";
dotenv.config();
const site = JSON.parse(fs.readFileSync(process.env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
const monitors = JSON.parse(
fs.readFileSync(process.env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8")

View File

@@ -5,6 +5,7 @@ if it does, it will read the file and parse it into a json array of objects
each objects will have a name, url, method: required
name of each of these objects need to be unique
*/
import * as dotenv from "dotenv";
import fs from "fs-extra";
import yaml from "js-yaml";
import { Cron } from "croner";
@@ -105,7 +106,7 @@ const Startup = async () => {
) {
monitors[i].includeDegradedInDowntime = false;
}
if(hasPing) {
if (hasPing) {
let hostsV4 = monitor.ping.hostsV4;
let hostsV6 = monitor.ping.hostsV6;
let hasV4 = false;
@@ -134,7 +135,6 @@ const Startup = async () => {
process.exit(1);
}
monitors[i].hasPing = true;
}
if (hasAPI) {
let url = monitor.api.url;

View File

@@ -1,6 +1,7 @@
// @ts-nocheck
import { MONITOR, SITE } from "./constants.js";
import dotenv from "dotenv";
dotenv.config();
const IsValidURL = function (url) {
return /^(http|https):\/\/[^ "]+$/.test(url);
};
@@ -142,7 +143,7 @@ const BeginningOfDay = (options = {}) => {
);
return dt.getTime() / 1000;
};
const ValidateIpAddress = function(input) {
const ValidateIpAddress = function (input) {
// Check if input is a valid IPv4 address
const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
if (ipv4Regex.test(input)) {
@@ -163,7 +164,7 @@ const ValidateIpAddress = function(input) {
// If none of the above conditions match, the input is invalid
return "Invalid";
}
};
export {
IsValidURL,
IsValidHTTPMethod,

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" class="dark dark:bg-background">
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import fs from "fs-extra";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import { ParseUptime } from "$lib/helpers.js";
import {
GetMinuteStartNowTimestampUTC,
@@ -17,7 +17,7 @@ const GetAllTags = function () {
let tags = [];
let monitors = [];
try {
monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
tags = monitors.map((monitor) => monitor.tag);
} catch (err) {
return [];
@@ -28,7 +28,7 @@ const CheckIfValidTag = function (tag) {
let tags = [];
let monitors = [];
try {
monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
tags = monitors.map((monitor) => monitor.tag);
if (tags.indexOf(tag) == -1) {
throw new Error("not a valid tag");
@@ -112,7 +112,7 @@ const store = function (data) {
}
//get the monitor object matching the tag
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const monitor = monitors.find((monitor) => monitor.tag === tag);
//read the monitor.path0Day file
@@ -126,7 +126,7 @@ const store = function (data) {
//write the monitor.path0Day file
fs.writeFileSync(
env.PUBLIC_KENER_FOLDER + `/${monitor.folderName}.webhook.${Randomstring.generate()}.json`,
PUBLIC_KENER_FOLDER + `/${monitor.folderName}.webhook.${Randomstring.generate()}.json`,
JSON.stringify(day0, null, 2)
);
@@ -259,7 +259,7 @@ const GetMonitorStatusByTag = function (tag) {
uptime: null,
lastUpdatedAt: null
};
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const { path0Day } = monitors.find((monitor) => monitor.tag === tag);
const dayData = JSON.parse(fs.readFileSync(path0Day, "utf8"));
const lastUpdatedAt = Object.keys(dayData)[Object.keys(dayData).length - 1];

View File

@@ -1,9 +1,9 @@
import fs from "fs-extra";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import i18n from "$lib/i18n/server";
export async function load({ params, route, url, cookies, request }) {
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
const headers = request.headers;
const userAgent = headers.get("user-agent");
let localTz = "GMT";

View File

@@ -27,6 +27,11 @@
{#each Object.entries(data.site.metaTags) as [key, value]}
<meta name={key} content={value} />
{/each}
{#if !!data.site.theme && data.site.theme === "dark"}
<script>
document.documentElement.classList.add("dark");
</script>
{/if}
</svelte:head>
<slot />

View File

@@ -5,11 +5,11 @@ import {
FilterAndInsertMonitorInIncident
} from "../../scripts/github.js";
import { FetchData } from "$lib/server/page";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function load({ parent }) {
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const parentData = await parent();
const siteData = parentData.site;
const github = siteData.github;

View File

@@ -3,7 +3,7 @@
import { json } from "@sveltejs/kit";
import { ParseIncidentPayload, auth, GHIssueToKenerIncident } from "$lib/server/webhook";
import { CreateIssue, SearchIssue } from "../../../../scripts/github";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function POST({ request }) {
@@ -27,7 +27,7 @@ export async function POST({ request }) {
}
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let resp = await CreateIssue(github, title, body, githubLabels);
if (resp === null) {
@@ -74,7 +74,7 @@ export async function GET({ request, url }) {
}
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
const repo = `${github.owner}/${github.repo}`;
const is = "issue";

View File

@@ -8,7 +8,7 @@ import {
GetEndTimeFromBody,
UpdateIssue
} from "../../../../../scripts/github";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function PATCH({ request, params }) {
@@ -41,7 +41,7 @@ export async function PATCH({ request, params }) {
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let resp = await UpdateIssue(github, incidentNumber, title, body, githubLabels);
if (resp === null) {
@@ -70,7 +70,7 @@ export async function GET({ request, params }) {
const incidentNumber = params.incidentNumber; //number required
// const headers = await request.headers();
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let issue = await GetIncidentByNumber(github, incidentNumber);
if (issue === null) {

View File

@@ -3,7 +3,7 @@
import { json } from "@sveltejs/kit";
import { auth } from "$lib/server/webhook";
import { AddComment, GetCommentsForIssue } from "../../../../../../scripts/github";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function GET({ request, params }) {
@@ -27,7 +27,7 @@ export async function GET({ request, params }) {
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let resp = await GetCommentsForIssue(incidentNumber, github);
return json(
@@ -75,7 +75,7 @@ export async function POST({ request, params }) {
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let resp = await AddComment(github, incidentNumber, body);

View File

@@ -3,7 +3,7 @@
import { json } from "@sveltejs/kit";
import { auth, GHIssueToKenerIncident } from "$lib/server/webhook";
import { UpdateIssueLabels, GetIncidentByNumber } from "../../../../../../scripts/github";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function POST({ request, params }) {
@@ -43,7 +43,7 @@ export async function POST({ request, params }) {
);
}
let site = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let site = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let github = site.github;
let issue = await GetIncidentByNumber(github, incidentNumber);

View File

@@ -1,9 +1,9 @@
// @ts-nocheck
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
import { StatusColor } from "$lib/helpers.js";
import { makeBadge } from "badge-maker";
const monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
export async function GET({ params, setHeaders, url }) {
// @ts-ignore
const { path0Day, name } = monitors.find((monitor) => monitor.tag === params.tag);

View File

@@ -1,10 +1,10 @@
// @ts-nocheck
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
import { ParseUptime } from "$lib/helpers.js";
import { makeBadge } from "badge-maker";
const monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
export async function GET({ params, url }) {
// @ts-ignore
const { path0Day, name } = monitors.find((monitor) => monitor.tag === params.tag);

View File

@@ -5,11 +5,11 @@ import {
FilterAndInsertMonitorInIncident
} from "../../../scripts/github.js";
import { FetchData } from "$lib/server/page";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function load({ params, route, url, parent }) {
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const parentData = await parent();
const siteData = parentData.site;
const github = siteData.github;

View File

@@ -1,10 +1,10 @@
// @ts-nocheck
import { FetchData } from "$lib/server/page";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function load({ params, route, url, parent }) {
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const parentData = await parent();
const monitorsActive = [];

View File

@@ -1,8 +1,8 @@
// @ts-nocheck
// @ts-ignore
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
const siteData = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
const siteData = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
export async function GET({ url, params }) {
const { tag } = params;
const query = url.searchParams;

View File

@@ -1,5 +1,5 @@
// @ts-nocheck
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import { GetIncidents, Mapper } from "../../../../scripts/github.js";
import fs from "fs-extra";
@@ -10,7 +10,7 @@ import fs from "fs-extra";
// @ts-ignore
export async function load({ params, route, url, parent }) {
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const siteData = await parent();
const github = siteData.site.github;
// @ts-ignore

View File

@@ -1,14 +1,14 @@
// @ts-nocheck
// @ts-ignore
import { json } from "@sveltejs/kit";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
import { GetCommentsForIssue } from "../../../../../scripts/github.js";
import { marked } from "marked";
export async function GET({ params }) {
const incidentNumber = params.id;
let siteData = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let siteData = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/site.json", "utf8"));
let comments = await GetCommentsForIssue(incidentNumber, siteData.github);
comments = comments.map(
(

View File

@@ -5,11 +5,11 @@ import {
FilterAndInsertMonitorInIncident
} from "../../../scripts/github.js";
import { FetchData } from "$lib/server/page";
import { env } from "$env/dynamic/public";
import { PUBLIC_KENER_FOLDER } from "$env/static/public";
import fs from "fs-extra";
export async function load({ params, route, url, parent }) {
let monitors = JSON.parse(fs.readFileSync(env.PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
let monitors = JSON.parse(fs.readFileSync(PUBLIC_KENER_FOLDER + "/monitors.json", "utf8"));
const parentData = await parent();
const siteData = parentData.site;
const github = siteData.github;