named some damn properties wrong
This commit is contained in:
parent
34df5fc6ee
commit
99442b4e01
5 changed files with 22 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -181,5 +181,5 @@ cython_debug/
|
|||
.cursorindexingignore
|
||||
|
||||
# Custom stuff
|
||||
gacha_game.db
|
||||
config.ini
|
||||
*.db
|
||||
*.ini
|
||||
|
|
|
@ -3,13 +3,13 @@ import traceback
|
|||
from parsing import parse_notification
|
||||
from db_utils import get_or_create_user, add_pull, get_config, set_config
|
||||
from fediverse_factory import get_fediverse_service
|
||||
import config
|
||||
|
||||
# Initialize the Fediverse service
|
||||
fediverse_service = get_fediverse_service()
|
||||
|
||||
# Define your whitelist
|
||||
# TODO: move to config
|
||||
whitelisted_instances: list[str] = []
|
||||
# Get trusted instances from config
|
||||
whitelisted_instances = config.TRUSTED_INSTANCES
|
||||
|
||||
def stream_notifications():
|
||||
print("Starting filtered notification stream...")
|
||||
|
|
|
@ -27,6 +27,10 @@ INSTANCE_TYPE = instance_type
|
|||
# Web server port
|
||||
WEB_PORT = config['application'].getint('WebPort', 5000)
|
||||
|
||||
# Trusted instances
|
||||
trusted_instances_str = config['application'].get('TrustedInstances', '')
|
||||
TRUSTED_INSTANCES = [instance.strip() for instance in trusted_instances_str.split(',') if instance.strip()]
|
||||
|
||||
# Extra stuff for control of the bot
|
||||
|
||||
# TODO: move this to db
|
||||
|
|
|
@ -99,9 +99,12 @@ class MisskeyService(FediverseService):
|
|||
|
||||
def get_notifications(self, since_id: Optional[str] = None) -> List[FediverseNotification]:
|
||||
"""Get notifications from Misskey instance"""
|
||||
params = {}
|
||||
params = {
|
||||
'include_types': ['mention', 'reply'],
|
||||
'limit': 50
|
||||
}
|
||||
if since_id:
|
||||
params["sinceId"] = since_id
|
||||
params["since_id"] = since_id
|
||||
|
||||
notifications = self.client.i_notifications(**params)
|
||||
return [self._convert_misskey_notification(notif) for notif in notifications]
|
||||
|
@ -121,13 +124,13 @@ class MisskeyService(FediverseService):
|
|||
}
|
||||
|
||||
if reply_to_id:
|
||||
params["replyId"] = reply_to_id
|
||||
params["reply_id"] = reply_to_id
|
||||
|
||||
if file_ids:
|
||||
params["fileIds"] = file_ids
|
||||
params["file_ids"] = file_ids
|
||||
|
||||
if visible_user_ids and visibility == Visibility.SPECIFIED:
|
||||
params["visibleUserIds"] = visible_user_ids
|
||||
params["visible_user_ids"] = visible_user_ids
|
||||
|
||||
response = self.client.notes_create(**params)
|
||||
return response.get("createdNote", {}).get("id", "")
|
||||
|
|
|
@ -20,4 +20,8 @@ DefaultAdmins = ['admin@example.tld']
|
|||
DatabaseLocation = ./gacha_game.db
|
||||
|
||||
; Web server port (default: 5000)
|
||||
WebPort = 5000
|
||||
WebPort = 5000
|
||||
|
||||
; Comma-separated list of trusted fediverse instances (leave empty to allow only local users)
|
||||
; Example: TrustedInstances = mastodon.social,misskey.io,pleroma.example.com
|
||||
TrustedInstances =
|
Loading…
Add table
Reference in a new issue