Compare commits
10 commits
13e1931345
...
55849a5847
Author | SHA1 | Date | |
---|---|---|---|
baalajimaestro | 55849a5847 | ||
baalajimaestro | 11742447a4 | ||
baalajimaestro | ad0eaf0612 | ||
baalajimaestro | f56c7e2ac8 | ||
baalajimaestro | 12aa976a20 | ||
baalajimaestro | 5eab571e37 | ||
baalajimaestro | eea438b3ab | ||
baalajimaestro | 364d2a9121 | ||
baalajimaestro | 9d1c116643 | ||
baalajimaestro | b7fb137def |
70
Dockerfile
70
Dockerfile
|
@ -1,37 +1,57 @@
|
||||||
FROM nimlang/nim:alpine as builder
|
FROM nimlang/nim:2.0.0-alpine as builder
|
||||||
|
|
||||||
RUN apk update && apk add git \
|
RUN apk update && apk add autoconf \
|
||||||
build-base \
|
automake \
|
||||||
curl \
|
|
||||||
bash \
|
bash \
|
||||||
openssl \
|
build-base \
|
||||||
openssl-dev \
|
cmake \
|
||||||
openssl-libs-static \
|
curl \
|
||||||
|
git \
|
||||||
|
libtool \
|
||||||
|
ninja \
|
||||||
|
perl \
|
||||||
sqlite-dev \
|
sqlite-dev \
|
||||||
sqlite-static
|
sqlite-static
|
||||||
|
|
||||||
|
|
||||||
|
ENV LIBRESSL_VERSION v3.8.0
|
||||||
|
|
||||||
|
# Compile LibreSSL Portable from source
|
||||||
|
RUN git clone https://github.com/libressl/portable --depth=1 -b ${LIBRESSL_VERSION} libressl && \
|
||||||
|
cd libressl && \
|
||||||
|
./autogen.sh && \
|
||||||
|
mkdir build-ninja && \
|
||||||
|
cd build-ninja && \
|
||||||
|
cmake -G"Ninja" .. && \
|
||||||
|
ninja
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN nimble install nimble --accept
|
|
||||||
|
|
||||||
# Build with necessary params to enable statically linking openssl, glibc and sqlite3
|
# Build with necessary params to enable statically linking openssl, glibc and sqlite3
|
||||||
RUN /root/.nimble/bin/nimble build --passL:-L/usr/lib \
|
RUN nimble build --passL:-L/usr/lib \
|
||||||
-d:ssl \
|
-d:ssl \
|
||||||
-p:. \
|
-d:libressl \
|
||||||
--dynlibOverride:ssl \
|
-p:. \
|
||||||
--dynlibOverride:crypto \
|
--dynlibOverride:ssl \
|
||||||
--dynlibOverride:sqlite3 \
|
--dynlibOverride:crypto \
|
||||||
--passl:-lssl \
|
--dynlibOverride:sqlite3 \
|
||||||
--passl:-lsqlite3 \
|
--dynlibOverride:tls \
|
||||||
--passl:-lcrypto \
|
--passl:-lssl \
|
||||||
--passL:-static \
|
--passl:-lsqlite3 \
|
||||||
--passL:"-flto" \
|
--passl:-lcrypto \
|
||||||
-d:release \
|
--passl:-ltls \
|
||||||
--opt:speed \
|
--passL:-L/libressl/build-ninja/ssl \
|
||||||
--mm:orc \
|
--passL:-L/libressl/build-ninja/crypto \
|
||||||
--deepcopy=on \
|
--passL:-L/libressl/build-ninja/tls \
|
||||||
--accept
|
--passL:-static \
|
||||||
|
--passL:"-flto" \
|
||||||
|
-d:release \
|
||||||
|
--opt:speed \
|
||||||
|
--mm:orc \
|
||||||
|
--threadAnalysis:off \
|
||||||
|
--deepcopy=on \
|
||||||
|
--accept
|
||||||
|
|
||||||
RUN strip -s /app/nim_censor_bot && \
|
RUN strip -s /app/nim_censor_bot && \
|
||||||
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot
|
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
author = "baalajimaestro"
|
author = "baalajimaestro"
|
||||||
description = "Censor Bot for Telegram written in Nim"
|
description = "Censor Bot for Telegram written in Nim"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
|
@ -10,6 +10,6 @@ bin = @["nim_censor_bot"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 1.6.0"
|
requires "nim >= 2.0.0"
|
||||||
requires "telebot >= 2023.04.13"
|
requires "telebot >= 2023.08.20"
|
||||||
requires "norm >= 2.8.0"
|
requires "norm >= 2.8.1"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2022 Maestro Creativescape
|
# Copyright © 2022-23 Maestro Creativescape
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
#
|
#
|
||||||
|
@ -209,8 +209,8 @@ proc inlineHandler(b: Telebot, u: InlineQuery): Future[bool]{.gcsafe, async.} =
|
||||||
res.inputMessageContent = InputMessageContent(kind: TextMessage,
|
res.inputMessageContent = InputMessageContent(kind: TextMessage,
|
||||||
messageText:"*NSFW " &
|
messageText:"*NSFW " &
|
||||||
capitalizeAscii(ftype) &
|
capitalizeAscii(ftype) &
|
||||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
"*\n\n[Tap to View](https://t.me/" &
|
||||||
b.username & "&start=" &
|
b.username & "?start=" &
|
||||||
u.query &
|
u.query &
|
||||||
")",
|
")",
|
||||||
parseMode: some("Markdown")).some
|
parseMode: some("Markdown")).some
|
||||||
|
@ -274,12 +274,13 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
discard await b.sendMessage(response.chat.id,
|
discard await b.sendMessage(response.chat.id,
|
||||||
"*NSFW " &
|
"*NSFW " &
|
||||||
"Album" &
|
"Album" &
|
||||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
"*\n\n[Tap to View](https://t.me/" &
|
||||||
b.username &
|
b.username &
|
||||||
"&start=" &
|
"?start=" &
|
||||||
filehash &
|
filehash &
|
||||||
")",
|
")",
|
||||||
replyMarkup = replymark,
|
replyMarkup = replymark,
|
||||||
|
disableWebPagePreview=true,
|
||||||
parseMode="Markdown")
|
parseMode="Markdown")
|
||||||
else:
|
else:
|
||||||
let filehash = GroupMedia[parseInt(response.mediaGroupId.get)]
|
let filehash = GroupMedia[parseInt(response.mediaGroupId.get)]
|
||||||
|
@ -297,12 +298,13 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
discard await b.sendMessage(response.chat.id,
|
discard await b.sendMessage(response.chat.id,
|
||||||
"*NSFW " &
|
"*NSFW " &
|
||||||
capitalizeAscii(ftype) &
|
capitalizeAscii(ftype) &
|
||||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
"*\n\n[Tap to View](https://t.me/" &
|
||||||
b.username &
|
b.username &
|
||||||
"&start=" &
|
"?start=" &
|
||||||
filehash &
|
filehash &
|
||||||
")",
|
")",
|
||||||
replyMarkup = replymark,
|
replyMarkup = replymark,
|
||||||
|
disableWebPagePreview=true,
|
||||||
parseMode="Markdown")
|
parseMode="Markdown")
|
||||||
OldDataCleanup()
|
OldDataCleanup()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue