Conversation
…g sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
cc: @its_buddhhu
There was a problem hiding this comment.
Pull request overview
This PR appears to align “V2” work by introducing a new aiohttp-based web layer (middleware + routers), adding new database backends/abstractions, and reshaping the plugin/db surface by removing many legacy modules/plugins while moving/merging some functionality into remaining modules.
Changes:
- Added web server building blocks (auth middleware, route decorators, routers, scraping helper, caching).
- Introduced new database abstraction + Redis/Mongo implementations and removed multiple legacy
pyUltroid/dB/*.pymodules. - Large plugin reshuffle: many plugin deletions, plus updates to help/menu/navigation and some plugin logic moved/merged.
Reviewed changes
Copilot reviewed 130 out of 133 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| strings/strings/en.yml | Updates help text for database/variables commands |
| requirements.txt | Adds new deps but currently duplicated entries |
| README.md | Removes an extra blank line |
| pyUltroid/web/tg_scraper.py | New Telegram web profile scraper helper |
| pyUltroid/web/routers/miniapp.py | New miniapp invoice endpoint + precheckout handler |
| pyUltroid/web/routers/admin.py | New owner-only admin update/restart endpoints |
| pyUltroid/web/middleware.py | New Telegram Mini App auth middleware |
| pyUltroid/web/decorators.py | New @route decorator + route registration |
| pyUltroid/web/cache.py | New TTL cache helper |
| pyUltroid/state_config.py | New temp JSON config storage helper |
| pyUltroid/startup/utils.py | Minor robustness tweak (plugin_name cast) |
| pyUltroid/startup/connections.py | Refactor session validation/logging |
| pyUltroid/startup/BaseClient.py | Formatting/parentheses changes in callbacks + constants |
| pyUltroid/startup/_extra.py | Removes legacy logging workaround |
| pyUltroid/startup/init.py | Startup/log init flow refactor |
| pyUltroid/scripts/webapp.py | Script to download/extract latest webapp release |
| pyUltroid/scripts/redis.py | Redis localhost helpers (start/stop/check) |
| pyUltroid/loader.py | Adds helper to load a single plugin by path |
| pyUltroid/fns/misc.py | Minor formatting changes |
| pyUltroid/fns/helper.py | Replaces aiohttp-based async_searcher with requests wrapper |
| pyUltroid/fns/FastTelethon.py | Minor formatting changes |
| pyUltroid/exceptions.py | One-line class declarations |
| pyUltroid/dB/warn_db.py | Removed legacy db helper module |
| pyUltroid/dB/snips_db.py | Removed legacy db helper module |
| pyUltroid/dB/nsfw_db.py | Removed legacy db helper module |
| pyUltroid/dB/notes_db.py | Removed legacy db helper module |
| pyUltroid/dB/mute_db.py | Removed legacy db helper module |
| pyUltroid/dB/greetings_db.py | Removed legacy db helper module |
| pyUltroid/dB/gban_mute_db.py | Removed legacy db helper module |
| pyUltroid/dB/forcesub_db.py | Removed legacy db helper module |
| pyUltroid/dB/filter_db.py | Removed legacy db helper module |
| pyUltroid/dB/filestore_db.py | Removed legacy db helper module |
| pyUltroid/dB/echo_db.py | Removed legacy db helper module |
| pyUltroid/dB/blacklist_db.py | Removed legacy db helper module |
| pyUltroid/dB/blacklist_chat_db.py | Removed legacy db helper module |
| pyUltroid/dB/asstcmd_db.py | Removed legacy db helper module |
| pyUltroid/dB/antiflood_db.py | Removed legacy db helper module |
| pyUltroid/dB/afk_db.py | Removed legacy db helper module |
| pyUltroid/database/base.py | New base database abstraction with caching |
| pyUltroid/database/redis.py | New Redis backend (contains Qovery parsing bug) |
| pyUltroid/database/mongo.py | New Mongo backend |
| pyUltroid/configs.py | Adds web-related configuration variables |
| pyUltroid/_misc/_wrappers.py | Minor exception syntax cleanup |
| pyUltroid/_misc/_decorators.py | Comments out title-based guard logic |
| pyUltroid/main.py | Startup task scheduling + optional web server start |
| pyUltroid/init.py | DB init refactor + year display change |
| plugins/ziptools.py | Removed plugin |
| plugins/youtube.py | Removed plugin |
| plugins/writer.py | Removed plugin |
| plugins/words.py | Removed plugin |
| plugins/webupload.py | Removed plugin |
| plugins/videotools.py | Removed plugin |
| plugins/variables.py | Removed plugin |
| plugins/unsplash.py | Removed plugin |
| plugins/tag.py | Removed plugin |
| plugins/snips.py | Removed plugin |
| plugins/schedulemsg.py | Removed plugin |
| plugins/resize.py | Removed plugin |
| plugins/qrcode.py | Removed plugin |
| plugins/profanityfilter.py | Removed plugin |
| plugins/polls.py | Removed plugin |
| plugins/other.py | Removed plugin |
| plugins/nsfwfilter.py | Removed plugin |
| plugins/notes.py | Removed plugin |
| plugins/nightmode.py | Removed plugin |
| plugins/misc.py | Removed plugin |
| plugins/logo.py | Removed plugin |
| plugins/locks.py | Removed plugin |
| plugins/glitch.py | Removed plugin |
| plugins/giftools.py | Removed plugin |
| plugins/forcesubscribe.py | Removed plugin |
| plugins/fontgen.py | Removed plugin |
| plugins/filter.py | Removed plugin |
| plugins/fakeaction.py | Removed plugin |
| plugins/extra.py | Removed plugin |
| plugins/echo.py | Removed plugin |
| plugins/converter.py | Removed plugin |
| plugins/compressor.py | Removed plugin |
| plugins/cleanaction.py | Removed plugin |
| plugins/chatbot.py | Removed plugin |
| plugins/calculator.py | Removed plugin |
| plugins/button.py | Removed plugin |
| plugins/blacklist.py | Removed plugin |
| plugins/beautify.py | Removed plugin |
| plugins/autopic.py | Removed plugin |
| plugins/autoban.py | Removed plugin |
| plugins/audiotools.py | Removed plugin |
| plugins/asstcmd.py | Removed plugin |
| plugins/antiflood.py | Removed plugin |
| plugins/afk.py | Removed plugin |
| plugins/_wspr.py | Removed plugin |
| plugins/mediatools.py | Removes mediainfo help text entry |
| plugins/fileshare.py | Inlines filestore DB logic (contains relative import bug) |
| plugins/database.py | Adds {i}get ... handler into database plugin |
| plugins/core.py | Adds publishpg publishing command |
| plugins/chats.py | Minor formatting change |
| plugins/_inline.py | Help menu refactor + safer callback data delimiting |
| plugins/_help.py | Generates help menu dynamically + addon base-name lookup |
| plugins/init.py | Switches Database alias + reintroduces STUFF/something helpers |
| install-termux | Adds redis package install |
| assistant/localization.py | Fixes imports to use strings module functions |
| assistant/inlinestuff.py | Adds inline prompt for starting assistant bot |
| assistant/callbackstuffs.py | Adds missing get_string import |
| assistant/init.py | Removes unused imports |
| .gitignore | Ignores redis dump + webapp resources directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+60
to
+69
| var, hash_, host, password = "", "", "", "" | ||
| for vars_ in os.environ: | ||
| if vars_.startswith("QOVERY_REDIS_") and vars.endswith("_HOST"): | ||
| var = vars_ | ||
| if var: | ||
| hash_ = var.split("_", maxsplit=2)[1].split("_")[0] | ||
| if hash: | ||
| kwargs["host"] = os.environ.get(f"QOVERY_REDIS_{hash_}_HOST") | ||
| kwargs["port"] = os.environ.get(f"QOVERY_REDIS_{hash_}_PORT") | ||
| kwargs["password"] = os.environ.get(f"QOVERY_REDIS_{hash_}_PASSWORD") |
Comment on lines
+604
to
+607
| def fetch_sync(url, re_json=False, evaluate=None, method="GET", *args, **kwargs): | ||
| methods = {"POST": requests.post, "HEAD": requests.head, "GET": requests.get} | ||
| method = "POST" if kwargs.pop("post", False) else "GET" | ||
| output = requests.request(method, url, *args, **kwargs) |
Comment on lines
+67
to
+77
| data_check_string = "\n".join([f"{rec[0]}={rec[1]}" for rec in data_pairs]) | ||
| logger.debug(f"Data check string for HMAC:\n{data_check_string}") | ||
|
|
||
| secret_key = hmac.new(c_str.encode(), token.encode(), hashlib.sha256).digest() | ||
| calculated_hash = hmac.new( | ||
| secret_key, data_check_string.encode(), hashlib.sha256 | ||
| ).hexdigest() | ||
|
|
||
| logger.debug(f"Expected hash: {hash_str}") | ||
| logger.debug(f"Calculated hash: {calculated_hash}") | ||
| return calculated_hash == hash_str |
Comment on lines
+123
to
+126
| async def get_file_link(msg): | ||
| from .. import udB | ||
|
|
||
| msg_id = await msg.forward_to(udB.get_key("LOG_CHANNEL")) |
Comment on lines
+136
to
+151
| async def get_stored_file(event, hash): | ||
| from .. import udB, asst | ||
|
|
||
| msg_id = get_stored_msg(hash) | ||
| if not msg_id: | ||
| return | ||
| try: | ||
| msg = await asst.get_messages(udB.get_key("LOG_CHANNEL"), ids=msg_id) | ||
| except Exception as er: | ||
| LOGS.warning(f"FileStore, Error: {er}") | ||
| return | ||
| if not msg_id: | ||
| return await asst.send_message( | ||
| event.chat_id, "__Message was deleted by owner!__", reply_to=event.id | ||
| ) | ||
| await asst.send_message(event.chat_id, msg.text, file=msg.media, reply_to=event.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.