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 \
|
||||
build-base \
|
||||
curl \
|
||||
RUN apk update && apk add autoconf \
|
||||
automake \
|
||||
bash \
|
||||
openssl \
|
||||
openssl-dev \
|
||||
openssl-libs-static \
|
||||
build-base \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libtool \
|
||||
ninja \
|
||||
perl \
|
||||
sqlite-dev \
|
||||
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
|
||||
WORKDIR /app
|
||||
|
||||
RUN nimble install nimble --accept
|
||||
|
||||
# Build with necessary params to enable statically linking openssl, glibc and sqlite3
|
||||
RUN /root/.nimble/bin/nimble build --passL:-L/usr/lib \
|
||||
-d:ssl \
|
||||
-p:. \
|
||||
--dynlibOverride:ssl \
|
||||
--dynlibOverride:crypto \
|
||||
--dynlibOverride:sqlite3 \
|
||||
--passl:-lssl \
|
||||
--passl:-lsqlite3 \
|
||||
--passl:-lcrypto \
|
||||
--passL:-static \
|
||||
--passL:"-flto" \
|
||||
-d:release \
|
||||
--opt:speed \
|
||||
--mm:orc \
|
||||
--deepcopy=on \
|
||||
--accept
|
||||
RUN nimble build --passL:-L/usr/lib \
|
||||
-d:ssl \
|
||||
-d:libressl \
|
||||
-p:. \
|
||||
--dynlibOverride:ssl \
|
||||
--dynlibOverride:crypto \
|
||||
--dynlibOverride:sqlite3 \
|
||||
--dynlibOverride:tls \
|
||||
--passl:-lssl \
|
||||
--passl:-lsqlite3 \
|
||||
--passl:-lcrypto \
|
||||
--passl:-ltls \
|
||||
--passL:-L/libressl/build-ninja/ssl \
|
||||
--passL:-L/libressl/build-ninja/crypto \
|
||||
--passL:-L/libressl/build-ninja/tls \
|
||||
--passL:-static \
|
||||
--passL:"-flto" \
|
||||
-d:release \
|
||||
--opt:speed \
|
||||
--mm:orc \
|
||||
--threadAnalysis:off \
|
||||
--deepcopy=on \
|
||||
--accept
|
||||
|
||||
RUN strip -s /app/nim_censor_bot && \
|
||||
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
author = "baalajimaestro"
|
||||
description = "Censor Bot for Telegram written in Nim"
|
||||
license = "AGPL-3.0-or-later"
|
||||
|
@ -10,6 +10,6 @@ bin = @["nim_censor_bot"]
|
|||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 1.6.0"
|
||||
requires "telebot >= 2023.04.13"
|
||||
requires "norm >= 2.8.0"
|
||||
requires "nim >= 2.0.0"
|
||||
requires "telebot >= 2023.08.20"
|
||||
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
|
||||
#
|
||||
|
@ -209,8 +209,8 @@ proc inlineHandler(b: Telebot, u: InlineQuery): Future[bool]{.gcsafe, async.} =
|
|||
res.inputMessageContent = InputMessageContent(kind: TextMessage,
|
||||
messageText:"*NSFW " &
|
||||
capitalizeAscii(ftype) &
|
||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
||||
b.username & "&start=" &
|
||||
"*\n\n[Tap to View](https://t.me/" &
|
||||
b.username & "?start=" &
|
||||
u.query &
|
||||
")",
|
||||
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,
|
||||
"*NSFW " &
|
||||
"Album" &
|
||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
||||
"*\n\n[Tap to View](https://t.me/" &
|
||||
b.username &
|
||||
"&start=" &
|
||||
"?start=" &
|
||||
filehash &
|
||||
")",
|
||||
replyMarkup = replymark,
|
||||
disableWebPagePreview=true,
|
||||
parseMode="Markdown")
|
||||
else:
|
||||
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,
|
||||
"*NSFW " &
|
||||
capitalizeAscii(ftype) &
|
||||
"*\n\n[Tap to View](tg://resolve?domain=" &
|
||||
"*\n\n[Tap to View](https://t.me/" &
|
||||
b.username &
|
||||
"&start=" &
|
||||
"?start=" &
|
||||
filehash &
|
||||
")",
|
||||
replyMarkup = replymark,
|
||||
disableWebPagePreview=true,
|
||||
parseMode="Markdown")
|
||||
OldDataCleanup()
|
||||
|
||||
|
|
Loading…
Reference in a new issue