Skip to content

Commit

Permalink
1.6.4
Browse files Browse the repository at this point in the history
- Completely remove Dragon support as redundant
- Fix request_join error
- Decrease module info length in heta
- Add privacy switch to `UnitHeta`
- Add HikkaHost as a platform
- Update to Hikka-TL 2.0.6
- Allow double-restart
- #115
- #114
- #119
- #120
- Other changes
  • Loading branch information
hikariatama committed Oct 29, 2023
1 parent ce1f24f commit f23e09a
Show file tree
Hide file tree
Showing 37 changed files with 1,811 additions and 1,648 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Hikka Changelog

## 🌑 Hikka 1.6.4

- Completely remove Dragon support as redundant
- Fix request_join error
- Decrease module info length in heta
- Add privacy switch to `UnitHeta`
- Add HikkaHost as a platform
- Update to Hikka-TL 2.0.6
- Allow double-restart
- https://github.com/hikariatama/Hikka/issues/115
- https://github.com/hikariatama/Hikka/issues/114
- https://github.com/hikariatama/Hikka/issues/119
- https://github.com/hikariatama/Hikka/issues/120
- Other changes

## 🌑 Hikka 1.6.3

- Add argument `item_type` to `db.pointer` to provide interface for NamedTuple objects
Expand Down
67 changes: 55 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,63 @@
FROM python:3.8-slim as python-base
ENV DOCKER=true
ENV GIT_PYTHON_REFRESH=quiet
# Dockerfile from https://github.com/python-poetry/poetry/discussions/1879
# `python-base` sets up all our shared environment variables
FROM python:3.9.5-slim as python-base
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc as files
PYTHONDONTWRITEBYTECODE=1 \
\
# pip
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.6.1 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
# it gets named `.venv`
POETRY_VIRTUALENVS_IN_PROJECT=true \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
\
# paths
# this is where our requirements + virtual environment will live
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv" \
# Hikka
DOCKER=true \
GIT_PYTHON_REFRESH=quiet

ENV PIP_NO_CACHE_DIR=1 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# prepend poetry and venv to path
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"

RUN apt update && apt install libcairo2 git build-essential -y --no-install-recommends
RUN rm -rf /var/lib/apt/lists /var/cache/apt/archives /tmp/*

RUN mkdir /data
# `builder-base` stage is used to build deps + create our virtual environment
FROM python-base as builder-base
RUN apt-get update && apt-get install --no-install-recommends -y \
# deps for installing poetry
curl \
# deps for building python deps
build-essential

COPY . /data/Hikka
WORKDIR /data/Hikka
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
RUN curl -sSL https://install.python-poetry.org | python -

# copy project requirement files here to ensure they will be cached.
WORKDIR $PYSETUP_PATH
COPY poetry.lock pyproject.toml ./

# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --no-dev

RUN pip install --no-warn-script-location --no-cache-dir -U -r requirements.txt

# `production` image used for runtime
FROM python-base as production
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH

WORKDIR /data/Hikka
COPY . /data/Hikka

EXPOSE 8080

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Simply run this command out of <b>root</b> and follow the instructions of instal
<li>📼 Improved and new <b>core modules</b></li>
<li>⏱ Quick <b>bug fixes</b> (compared to official FTG and GeekTG)</li>
<li>▶️ <b>Inline forms, galleries and lists</b></li>
<li>🔁 Full <b>backward compatibility</b> with FTG, GeekTG and Dragon Userbot modules</li>
<li>🔁 Full <b>backward compatibility</b> with FTG and GeekTG modules</li>
</ul>
<hr>
<h2 border="none"><img src="https://github.com/hikariatama/assets/raw/master/1312-micro-sd-card-flat.webp" height="54" align="middle"> Requirements</h2>
Expand Down Expand Up @@ -134,5 +134,4 @@ Check out <a href="https://dev.hikka.pw">dev.hikka.pw</a> for developers' docume
<li><a href="https://t.me/tiefeschwarz">Aldehydesäure</a> for German translation pack</li>
<li><a href="https://t.me/amorescam">Amore</a> for Uzbek translation pack</li>
<li><a href="https://t.me/lonami">Lonami</a> for Telethon, which is the base of Hikka-TL</li>
<li><a href="https://github.com/delivrance">Dan</a> for pyrogram, which is the base of Hikka-Pyro</li>
</ul>
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: "3"
services:
worker:
container_name: "hikka-worker"
build:
context: .
volumes:
- worker:/data
stop_signal: SIGINT
restart: unless-stopped
command: "python -m hikka"
ports:
- "${EXTERNAL_PORT:-8080}:8080"

Expand Down
10 changes: 4 additions & 6 deletions hikka/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ def deps():
try:
import hikkatl # noqa: F811

if tuple(map(int, hikkatl.__version__.split("."))) < (2, 0, 4):
raise ImportError

import hikkapyro

if tuple(map(int, hikkapyro.__version__.split("."))) < (2, 0, 103):
if tuple(map(int, hikkatl.__version__.split("."))) < (2, 0, 6):
raise ImportError
except ImportError:
print("🔄 Installing dependencies...")
Expand All @@ -86,4 +81,7 @@ def deps():
if "HIKKA_DO_NOT_RESTART" in os.environ:
del os.environ["HIKKA_DO_NOT_RESTART"]

if "HIKKA_DO_NOT_RESTART2" in os.environ:
del os.environ["HIKKA_DO_NOT_RESTART2"]

main.hikka.main() # Execute main function
9 changes: 6 additions & 3 deletions hikka/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def die():


def restart():
if "HIKKA_DO_NOT_RESTART" in os.environ:
if "HIKKA_DO_NOT_RESTART2" in os.environ:
print(
"Got in a loop, exiting\nYou probably need to manually remove existing"
" packages and then restart Hikka. Run `pip uninstall -y telethon"
" telethon-mod hikka-tl pyrogram hikka-pyro`, then restart Hikka."
" telethon-mod hikka-tl`, then restart Hikka."
)
sys.exit(0)

Expand All @@ -54,7 +54,10 @@ def restart():
os.system("lavhost restart")
return

os.environ["HIKKA_DO_NOT_RESTART"] = "1"
if "HIKKA_DO_NOT_RESTART" not in os.environ:
os.environ["HIKKA_DO_NOT_RESTART"] = "1"
else:
os.environ["HIKKA_DO_NOT_RESTART2"] = "1"

if "DOCKER" in os.environ:
atexit.register(get_startup_callback())
Expand Down
Loading

0 comments on commit f23e09a

Please sign in to comment.