Compare commits
No commits in common. "2f8bce9a8af79223d032dae1caa880ddeb8b1e16" and "b92ec6474612f732763ab410086dab35f81a9782" have entirely different histories.
2f8bce9a8a
...
b92ec64746
32
Makefile
32
Makefile
@ -44,34 +44,4 @@ shell:
|
||||
$(IMAGE) /bin/sh
|
||||
|
||||
help:
|
||||
@printf "Usage:\n make build Build local docker image ($(IMAGE))\n make run Run image mounting project into $(WORKDIR) (port $(PORT))\n make stop Stop running container\n make shell Start a shell in a container with project mounted\n\nOverride variables: IMAGE, CONTAINER, WORKDIR, PORT, DOCKER_BUILD_ARGS, DOCKER_RUN_ARGS\n"
|
||||
|
||||
git_info:
|
||||
$(eval GIT_HASH = $(shell git rev-parse HEAD))
|
||||
$(eval GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD))
|
||||
|
||||
|
||||
publish: git_info
|
||||
$(eval VERSION = $(shell git describe --tags 2>/dev/null | grep -e '^[0-9]\.[0-9]*\.[0-9]'))
|
||||
@if [ -z "${VERSION}" ]; \
|
||||
then \
|
||||
echo "Error: Nincs verzió szám"; \
|
||||
exit 1; \
|
||||
fi
|
||||
#@sudo docker login $(DOCKER_REGISTRY)
|
||||
@sudo docker build \
|
||||
--no-cache \
|
||||
--label version=$(VERSION) \
|
||||
--label org.opencontainers.image.created=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||
--label org.opencontainers.image.authors="Krisztián Szabolcsi" \
|
||||
--label org.opencontainers.image.version=$(VERSION) \
|
||||
--label org.opencontainers.image.licences=MIT \
|
||||
--label org.opencontainers.image.source=https://${DOCKER_REGISTRY}/${OWNER}/${NAME} \
|
||||
--label org.opencontainers.image.revision=$(GIT_HASH) \
|
||||
--label org.opencontainers.image.vendor="Krisztián Szabolcsi" \
|
||||
--label org.opencontainers.image.description="IMAP email notification service using ntfy.sh" \
|
||||
--label org.opencontainers.image.source.branch=$(GIT_BRANCH) \
|
||||
--label org.opencontainers.image.source.hash=$(GIT_HASH) \
|
||||
-t $(DOCKER_REGISTRY)/${OWNER}/$(NAME):$(VERSION) \
|
||||
.
|
||||
@sudo docker push $(DOCKER_REGISTRY)/$(NAME):$(VERSION)
|
||||
@printf "Usage:\n make build Build local docker image ($(IMAGE))\n make run Run image mounting project into $(WORKDIR) (port $(PORT))\n make stop Stop running container\n make shell Start a shell in a container with project mounted\n\nOverride variables: IMAGE, CONTAINER, WORKDIR, PORT, DOCKER_BUILD_ARGS, DOCKER_RUN_ARGS\n"
|
||||
@ -1,2 +1 @@
|
||||
NAME=imap_notification
|
||||
DOCKER_REGISTRY=gitea.szabolcsi.dev
|
||||
@ -6,7 +6,6 @@ const i18n = require('./i18n');
|
||||
const NTFY_INTERNAL_URL = process.env.NTFY_URL || 'https://ntfy.sh';
|
||||
const CONFIG_PATH = process.env.CONFIG_PATH || './config.json';
|
||||
const LOG_LEVEL = process.env.LOG_LEVEL || 'info';
|
||||
const IMAP_FLOW_LOG = process.env.IMAP_FLOW_LOG || false;
|
||||
let config;
|
||||
|
||||
const fromIcon = "\uD83D\uDC64"; // 👤
|
||||
@ -88,21 +87,18 @@ async function watchAccount(acc) {
|
||||
user: acc.user,
|
||||
pass: acc.pass
|
||||
},
|
||||
logger: IMAP_FLOW_LOG ? log.debug : false
|
||||
logger: (LOG_LEVEL === 'debug' ? log.debug : false)
|
||||
});
|
||||
|
||||
const run = async () => {
|
||||
try {
|
||||
await client.connect();
|
||||
|
||||
let lock = await client.getMailboxLock('INBOX');
|
||||
log.info(`[${acc.name}] ${i18n.t('watch_started')}`);
|
||||
|
||||
client.on('exists', async (data) => {
|
||||
// Fetch only envelope data (Subject, From)
|
||||
let message = await client.fetchOne(data.count, { envelope: true });
|
||||
|
||||
log.debug(`[${acc.name}] New message arrived:`, message);
|
||||
|
||||
const subject = message.envelope.subject || i18n.t('no_subject');
|
||||
const fromInfo = message.envelope.from[0];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user