Fixed dockerfile, added a docker-compose.yml, added db init function to run on every startup
This commit is contained in:
@@ -112,7 +112,7 @@ async function main( ) {
|
||||
}
|
||||
return false;
|
||||
})( ev );
|
||||
sendNotification(
|
||||
await sendNotification(
|
||||
`${today_prefix ? "TODAY " : ""}${notification_prefix ? notification_prefix + ": " : ""} ${ev.title} (${ TEventType[ ev.event_type ] })`,
|
||||
`${body}`
|
||||
// `${ev.link || "https://77th-jsoc.com/#/events"}`
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import * as Bun from "bun";
|
||||
|
||||
export function sendNotification(title: string, body: string, click?: string | null) {
|
||||
export async function sendNotification(title: string, body: string, click?: string | null) {
|
||||
const command = [
|
||||
"python",
|
||||
"./app/notification.py",
|
||||
"./src/notification.py",
|
||||
`--title=${title}`,
|
||||
`--body=${body}`,
|
||||
];
|
||||
if (click) {
|
||||
if ( click ) {
|
||||
command.push(`--click=${click}`);
|
||||
}
|
||||
Bun.spawn(command);
|
||||
const proc = Bun.spawn(command);
|
||||
const text = await proc.stdout.text();
|
||||
console.log("sendNotification: " + text);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ export const db = new Database(db_filepath);
|
||||
|
||||
export function init () {
|
||||
Event.createTable(db);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
Reference in New Issue
Block a user