fuck python, switching to apprise-api as a docker container
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
FROM debian:12 AS base
|
||||
WORKDIR /opt/app
|
||||
RUN apt-get update && \
|
||||
# apt-get install -y curl unzip cron ca-certificates python3 python3-pip && \
|
||||
apt-get install -y curl unzip cron ca-certificates python3 python3-pip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
# install BunJs
|
||||
@@ -19,8 +20,8 @@ COPY package.json bun.lock /temp/prod/
|
||||
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
||||
|
||||
# and install python dependencies
|
||||
COPY ./requirements.txt .
|
||||
RUN python3 -m pip install --break-system-packages -r requirements.txt
|
||||
# COPY ./requirements.txt .
|
||||
# RUN python3 -m pip install --break-system-packages -r requirements.txt
|
||||
# RUN python3 -m pip install -U python-dotenv
|
||||
|
||||
# copy node_modules from temp directory
|
||||
|
||||
@@ -3,3 +3,20 @@ services:
|
||||
build: .
|
||||
volumes:
|
||||
- ./data/db:/opt/app/data/db
|
||||
apprise:
|
||||
image: caronc/apprise:latest
|
||||
environment:
|
||||
- APPRISE_WORKER_COUNT=1
|
||||
- APPRISE_STATEFUL_MODE=simple
|
||||
- PUID=$(id -u)
|
||||
- PGID=$(id -g)
|
||||
volumes:
|
||||
- ./data/apprise/config:/config
|
||||
- ./data/apprise/plugin:/plugin
|
||||
- ./data/apprise/attach:/attach
|
||||
ports:
|
||||
- 8000:8000
|
||||
networks:
|
||||
default:
|
||||
external: true
|
||||
name: npm
|
||||
28
src/app.ts
28
src/app.ts
@@ -112,11 +112,29 @@ async function main( ) {
|
||||
}
|
||||
return false;
|
||||
})( ev );
|
||||
await sendNotification(
|
||||
`${today_prefix ? "TODAY " : ""}${notification_prefix ? notification_prefix + ": " : ""} ${ev.title} (${ TEventType[ ev.event_type ] })`,
|
||||
`${body}`
|
||||
// `${ev.link || "https://77th-jsoc.com/#/events"}`
|
||||
);
|
||||
const title = `${today_prefix ? "TODAY " : ""}${notification_prefix ? notification_prefix + ": " : ""} ${ev.title} (${ TEventType[ ev.event_type ] })`;
|
||||
|
||||
await fetch("http://localhost:8000/notify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
urls: [
|
||||
`ntfys://${process.env.ntfy_username}:${process.env.ntfy_password}@${process.env.ntfy_host}/${process.env.ntfy_topic}${ ev.link ? `?click=${ev.link}`: "?click=https://77th-jsoc.com/#/events" }`,
|
||||
`discord://${process.env.dc_webhook}?avatar_url=${process.env.dc_avatar_url}&botname=${process.env.dc_botname}`
|
||||
].join(","),
|
||||
title: title,
|
||||
body: body,
|
||||
format: "text"
|
||||
})
|
||||
});
|
||||
|
||||
// await sendNotification(
|
||||
// title,
|
||||
// body
|
||||
// // `${ev.link || "https://77th-jsoc.com/#/events"}`
|
||||
// );
|
||||
ev.set_notification("done", db);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user