Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f3d04e935c
|
|||
| e5797e60b7 | |||
|
0c5cf29f83
|
|||
|
43c38767a1
|
@@ -0,0 +1 @@
|
||||
secret.yaml
|
||||
@@ -0,0 +1,32 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cfddns
|
||||
labels:
|
||||
app: cfddns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cfddns
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cfddns
|
||||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: cloudflare-ddns
|
||||
image: timothyjmiller/cloudflare-ddns:latest
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
requests:
|
||||
memory: "32Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "64Mi"
|
||||
cpu: "100m"
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: cfddns-secrets
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cfddns-secrets
|
||||
type: Opaque
|
||||
stringData:
|
||||
CLOUDFLARE_API_TOKEN: your_token
|
||||
DOMAINS: "example.com,www.example.com"
|
||||
IP4_PROVIDER: cloudflare.trace
|
||||
IP6_PROVIDER: none
|
||||
UPDATE_CRON: "@every 5m"
|
||||
UPDATE_ON_START: "true"
|
||||
DELETE_ON_STOP: "false"
|
||||
DELETE_ON_FAILURE: "true"
|
||||
TTL: "1"
|
||||
PROXIED: "true"
|
||||
EMOJI: "true"
|
||||
REJECT_CLOUDFLARE_IPS: "true"
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:v3.7
|
||||
image: traefik:v3.7.4
|
||||
container_name: traefik
|
||||
restart: unless-stopped
|
||||
command:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
API_ID=""
|
||||
API_HASH=""
|
||||
STRINGSESSION=""
|
||||
@@ -0,0 +1,14 @@
|
||||
# apiflash api key only for webshot plugin
|
||||
APIFLASH_KEY=""
|
||||
# gemini api key only for gemini plugin
|
||||
GEMINI_KEY=""
|
||||
# VT api key only for VirusTotal plugin
|
||||
VT_KEY=""
|
||||
# rmbg api key only for removebg plugin
|
||||
RMBG_KEY=""
|
||||
# cohere api key only for cohere plugin
|
||||
COHERE_KEY=""
|
||||
# sqlite/sqlite3 or mongo/mongodb
|
||||
DATABASE_TYPE=""
|
||||
# file name for sqlite3, database name for mongodb
|
||||
DATABASE_NAME=""
|
||||
@@ -14,3 +14,6 @@ __pycache__/
|
||||
/downloads/
|
||||
/Downloads/
|
||||
config.ini
|
||||
|
||||
k8s/*/*secret*.yaml
|
||||
!k8s/account-secrets.yaml.example
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: userbot-common-config
|
||||
data:
|
||||
DATABASE_TYPE: ""
|
||||
DATABASE_NAME: ""
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- userbots.yaml
|
||||
- common-secret.yaml
|
||||
- common-config.yaml
|
||||
- forust-secrets.yaml
|
||||
- anna-secrets.yaml
|
||||
@@ -0,0 +1,114 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: forust-userbot-deployment
|
||||
labels:
|
||||
app: forust-userbot
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: forust-userbot
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: forust-userbot
|
||||
spec:
|
||||
containers:
|
||||
- name: forust-userbot
|
||||
image: gcr.forust.xyz/forust/userbot:latest
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: userbot-common-secrets
|
||||
- configMapRef:
|
||||
name: userbot-common-config
|
||||
- secretRef:
|
||||
name: userbot-forust-secrets
|
||||
volumeMounts:
|
||||
- name: forust-storage
|
||||
mountPath: /app/data
|
||||
subPath: data
|
||||
- name: forust-storage
|
||||
mountPath: /app/logs
|
||||
subPath: logs
|
||||
volumes:
|
||||
- name: forust-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: forust-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: forust-pvc
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: anna-userbot-deployment
|
||||
labels:
|
||||
app: anna-userbot
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: anna-userbot
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: anna-userbot
|
||||
spec:
|
||||
containers:
|
||||
- name: anna-userbot
|
||||
image: gcr.forust.xyz/forust/userbot:latest
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: userbot-common-secrets
|
||||
- configMapRef:
|
||||
name: userbot-common-config
|
||||
- secretRef:
|
||||
name: userbot-anna-secrets
|
||||
volumeMounts:
|
||||
- name: anna-storage
|
||||
mountPath: /app/data
|
||||
subPath: data
|
||||
- name: anna-storage
|
||||
mountPath: /app/logs
|
||||
subPath: logs
|
||||
volumes:
|
||||
- name: anna-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: anna-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: anna-pvc
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ../../base
|
||||
|
||||
patches:
|
||||
- path: patch-downloads.yaml
|
||||
@@ -0,0 +1,35 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: forust-userbot-deployment
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: forust-userbot
|
||||
volumeMounts:
|
||||
- name: downloads
|
||||
mountPath: /app/downloads
|
||||
volumes:
|
||||
- name: downloads
|
||||
hostPath:
|
||||
path: /home/user/projects/homelab/userbot/Downloads
|
||||
type: DirectoryOrCreate
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: anna-userbot-deployment
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: anna-userbot
|
||||
volumeMounts:
|
||||
- name: downloads
|
||||
mountPath: /app/downloads
|
||||
volumes:
|
||||
- name: downloads
|
||||
hostPath:
|
||||
path: /home/user/projects/homelab/userbot/Downloads
|
||||
type: DirectoryOrCreate
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ../../base
|
||||
|
||||
patches:
|
||||
- path: patch-downloads.yaml
|
||||
@@ -0,0 +1,35 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: forust-userbot-deployment
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: forust-userbot
|
||||
volumeMounts:
|
||||
- name: downloads
|
||||
mountPath: /app/downloads
|
||||
volumes:
|
||||
- name: downloads
|
||||
hostPath:
|
||||
path: /srv/homelab/userbot/Downloads
|
||||
type: DirectoryOrCreate
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: anna-userbot-deployment
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: anna-userbot
|
||||
volumeMounts:
|
||||
- name: downloads
|
||||
mountPath: /app/downloads
|
||||
volumes:
|
||||
- name: downloads
|
||||
hostPath:
|
||||
path: /srv/homelab/userbot/Downloads
|
||||
type: DirectoryOrCreate
|
||||
+14
-14
@@ -59,26 +59,26 @@ async def version(client: Client, message: Message):
|
||||
|
||||
await message.delete()
|
||||
|
||||
remote_url = list(gitrepo.remote().urls)[0]
|
||||
commit_time = (
|
||||
datetime.datetime.fromtimestamp(gitrepo.head.commit.committed_date)
|
||||
.astimezone(datetime.timezone.utc)
|
||||
.strftime("%Y-%m-%d %H:%M:%S %Z")
|
||||
)
|
||||
if gitrepo is not None:
|
||||
remote_url = list(gitrepo.remote().urls)[0]
|
||||
commit_time = (
|
||||
datetime.datetime.fromtimestamp(gitrepo.head.commit.committed_date)
|
||||
.astimezone(datetime.timezone.utc)
|
||||
.strftime("%Y-%m-%d %H:%M:%S %Z")
|
||||
)
|
||||
git_info = (
|
||||
f"\n<b>Branch: <a href={remote_url}/tree/{gitrepo.active_branch}>{gitrepo.active_branch}</a>\n"
|
||||
if gitrepo.active_branch != "master" else "\n"
|
||||
) + f"Commit: <a href={remote_url}/commit/{gitrepo.head.commit.hexsha}>" f"{gitrepo.head.commit.hexsha[:7]}</a> by {gitrepo.head.commit.author.name}\n" f"Commit time: {commit_time}</b>"
|
||||
else:
|
||||
git_info = ""
|
||||
|
||||
await message.reply(
|
||||
f"<b>Moon Userbot version: {userbot_version}\n"
|
||||
f"Changelog </b><i><a href=https://t.me/moonuserbot/{changelog}>in channel</a></i>.<b>\n"
|
||||
f"Changelog written by </b><i>"
|
||||
f"<a href=https://t.me/Qbtaumai>Abhi</a></i>\n\n"
|
||||
+ (
|
||||
f"<b>Branch: <a href={remote_url}/tree/{gitrepo.active_branch}>{gitrepo.active_branch}</a>\n"
|
||||
if gitrepo.active_branch != "master"
|
||||
else ""
|
||||
)
|
||||
+ f"Commit: <a href={remote_url}/commit/{gitrepo.head.commit.hexsha}>"
|
||||
f"{gitrepo.head.commit.hexsha[:7]}</a> by {gitrepo.head.commit.author.name}\n"
|
||||
f"Commit time: {commit_time}</b>",
|
||||
f"{git_info}",
|
||||
)
|
||||
|
||||
|
||||
|
||||
+5
-29
@@ -1,19 +1,3 @@
|
||||
# Moon-Userbot - telegram userbot
|
||||
# Copyright (C) 2020-present Moon Userbot Organization
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from sys import version_info
|
||||
from .db import db
|
||||
import git
|
||||
@@ -37,19 +21,11 @@ prefix = db.get("core.main", "prefix", ".")
|
||||
|
||||
try:
|
||||
gitrepo = git.Repo(".")
|
||||
except git.exc.InvalidGitRepositoryError:
|
||||
repo = git.Repo.init()
|
||||
origin = repo.create_remote(
|
||||
"origin", "https://github.com/The-MoonTg-project/Moon-Userbot"
|
||||
)
|
||||
origin.fetch()
|
||||
repo.create_head("main", origin.refs.main)
|
||||
repo.heads.main.set_tracking_branch(origin.refs.main)
|
||||
repo.heads.main.checkout(True)
|
||||
gitrepo = git.Repo(".")
|
||||
except (git.exc.InvalidGitRepositoryError, git.exc.NoSuchPathError):
|
||||
gitrepo = None
|
||||
|
||||
if len(gitrepo.tags) > 0:
|
||||
if gitrepo is not None and len(gitrepo.tags) > 0:
|
||||
commits_since_tag = list(gitrepo.iter_commits(f"{gitrepo.tags[-1].name}..HEAD"))
|
||||
userbot_version = f"2.5.{len(commits_since_tag)}"
|
||||
else:
|
||||
commits_since_tag = []
|
||||
userbot_version = f"2.5.{len(commits_since_tag)}"
|
||||
userbot_version = "2.5.0"
|
||||
|
||||
Reference in New Issue
Block a user