Skip to content

Commit

Permalink
minor refactor and docker build config update
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com>
  • Loading branch information
Rongronggg9 committed Sep 15, 2021
1 parent f73f671 commit b591a49
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 33 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/publish-docker-image-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,9 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub (x64)
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64
platforms: linux/amd64,linux/386,linux/arm64
tags: rongronggg9/rss-to-telegram:dev
- name: Push to Docker Hub (x86)
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/386
tags: rongronggg9/rss-to-telegram:dev
- name: Push to Docker Hub (arm64)
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/arm64
tags: rongronggg9/rss-to-telegram:dev
16 changes: 2 additions & 14 deletions .github/workflows/publish-docker-image-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,9 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub (x64)
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64
tags: rongronggg9/rss-to-telegram:latest
- name: Push to Docker Hub (x86)
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/386
tags: rongronggg9/rss-to-telegram:latest
- name: Push to Docker Hub (arm64)
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/arm64
platforms: linux/amd64,linux/386,linux/arm64
tags: rongronggg9/rss-to-telegram:latest
5 changes: 3 additions & 2 deletions docker-compose.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# 以后如果需要更新/停止/重启等,都在这个目录里操作
# <------ 命令 ------>
# 启动: docker-compose up -d
# 结束:docker-compose down
# 结束:docker-compose down -v
# 修改配置后更新配置: 先结束再启动
# 更新到最新版本: 同上
# 更新到最新版本: 先结束, 再 docker-compose pull
# 查看日志:docker logs rsstt

version: '3.6'

Expand Down
7 changes: 6 additions & 1 deletion feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def add_feed(self, name, link, uid: Optional[int] = None, timeout: Optional[int]
if rss_d is None:
return None
last = str(rss_d.entries[0]['link'])
fid = max(self._feeds.keys()) + 1 if self._feeds else 1
fid = self.current_fid
feed = Feed(fid=fid, name=name, link=link, last=last)

# acquire w lock
Expand All @@ -133,6 +133,11 @@ def del_feed(self, name):
logging.info(f'Removed feed {name}.')
return feed_to_delete

@property
@fasteners.lock.read_locked
def current_fid(self):
return max(self._feeds.keys()) + 1 if self._feeds else 1

@fasteners.lock.read_locked
def get_user_feeds(self) -> Optional[tuple]:
if not self._feeds:
Expand Down
4 changes: 2 additions & 2 deletions telegramRSSbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def permission_required(func=None, *, only_manager=False, only_in_private_chat=F

@functools.wraps(func)
def wrapper(update: telegram.Update, context: Optional[telegram.ext.CallbackContext] = None, *args, **kwargs):
message = update.message
command = message.text
message = update.effective_message
command = message.text if message.text else '(no command, file message)'
user_id = update.effective_user.id
user_fullname = update.effective_user.full_name
if only_manager and str(user_id) != env.MANAGER:
Expand Down

0 comments on commit b591a49

Please sign in to comment.