mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-07-04 13:43:12 +02:00
Address code review feedback and fix CodeQL security alert
Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>
This commit is contained in:
parent
674b08d79f
commit
2130511f02
5
.github/workflows/deploy.yml
vendored
5
.github/workflows/deploy.yml
vendored
@ -5,6 +5,9 @@ on:
|
|||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -13,7 +16,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
|
|||||||
4
main.py
4
main.py
@ -161,7 +161,9 @@ async def count_messages(message_content, counter):
|
|||||||
uuid = extract_source_uuid(message_content)
|
uuid = extract_source_uuid(message_content)
|
||||||
source_name = extract_source_name(message_content)
|
source_name = extract_source_name(message_content)
|
||||||
await counter.update_string_map(uuid, source_name)
|
await counter.update_string_map(uuid, source_name)
|
||||||
send_message(counter.string_map, PHONE_NUMBER)
|
# Use get_recipient() to respect debug mode - send count update to self in debug mode
|
||||||
|
recipient = get_recipient()
|
||||||
|
send_message(counter.string_map, recipient)
|
||||||
|
|
||||||
|
|
||||||
async def scheduled_task(counter):
|
async def scheduled_task(counter):
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class TestShouldCount:
|
|||||||
assert should_count(message_content) is False
|
assert should_count(message_content) is False
|
||||||
|
|
||||||
def test_should_count_empty_content(self):
|
def test_should_count_empty_content(self):
|
||||||
"""Test that empty content should not be counted - empty dict returns True currently"""
|
"""Test that empty dict returns True (no sticker found means message is counted)"""
|
||||||
from main import should_count
|
from main import should_count
|
||||||
# Empty dict is counted (no sticker found)
|
# Empty dict is counted (no sticker found)
|
||||||
assert should_count({}) is True
|
assert should_count({}) is True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user