Compare commits

...

10 commits

Author SHA1 Message Date
baalajimaestro 55849a5847
Upgrade to Nim 2.0
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-08-21 15:05:53 +05:30
baalajimaestro 11742447a4
Fixup b7fb137def
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-06-04 15:29:26 +05:30
baalajimaestro ad0eaf0612
Add missing libressl parameter
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 11:22:12 +05:30
baalajimaestro f56c7e2ac8
Add a bit of comments
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 11:03:17 +05:30
baalajimaestro 12aa976a20
Use libressl instead of openssl
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 11:01:57 +05:30
baalajimaestro 5eab571e37
Include upstream patch to fix libressl
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 10:58:08 +05:30
baalajimaestro eea438b3ab
Build nim from source instead of prebuilts
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 10:57:11 +05:30
baalajimaestro 364d2a9121
Uprev botapi
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-31 08:18:55 +05:30
baalajimaestro 9d1c116643
Update copyright for 2023
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-25 11:24:12 +05:30
baalajimaestro b7fb137def
Fix deeplinks on ios
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2023-05-25 11:23:51 +05:30
3 changed files with 58 additions and 36 deletions

View file

@ -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

View file

@ -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"

View file

@ -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()