Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wip: SS Central - whitelist, discord link #946

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

Furrior
Copy link
Collaborator

@Furrior Furrior commented Dec 31, 2024

Что этот PR делает

fixes #191 #65 #66

Почему это хорошо для игры

  • Игрокам проще привязывать дискорд так
  • Возможность иметь разные вайтлисты, не привязанные к порту

Изображения изменений

Тестирование

  • Привязка дс работает
  • Выдача вайтлиста через интервью работает

Changelog

🆑
add: Привязка дискорда через OAuth
tweak: Новая система белого списка
/:cl:

Summary by Sourcery

Implement Discord link via OAuth and a new whitelist system that uses SS Central.

New Features:

  • Players can now link their Discord accounts.
  • A new whitelist system is implemented, integrating with SS Central.

Tests:

  • Removed tests related to the old whitelist system.

Copy link

sourcery-ai bot commented Dec 31, 2024

Reviewer's Guide by Sourcery

This PR implements Discord account linking via OAuth and a new whitelist system through SS Central. It removes client-side Discord ID lookup and verification, instead relying on SS Central for these functionalities.

Sequence diagram for new Discord OAuth linking process

sequenceDiagram
    actor User
    participant Client
    participant SSCentral
    participant Discord

    User->>Client: Initiates Discord verification
    Client->>SSCentral: Request verification token
    SSCentral-->>Client: Return login URL with token
    Client-->>User: Display login URL
    User->>Discord: Authenticate via OAuth
    Discord->>SSCentral: Confirm authentication
    SSCentral-->>Client: Update Discord link status
Loading

Class diagram for SS Central subsystem

classDiagram
    class SSCentral {
        -list discord_links
        +Initialize()
        +load_whitelist()
        +get_player_discord_async(client)
        +is_player_whitelisted(ckey)
        +add_to_whitelist(ckey, added_by, duration)
        +whitelist_ban_player(player_ckey, admin_ckey, duration, reason)
    }

    class Interview {
        +owner_ckey
        +questions[]
        +responses[]
        +approve(client)
        +deny(client)
        +serialize_embed()
    }

    SSCentral -- Interview
    note for SSCentral "New centralized system for
whitelist and Discord management"
Loading

File-Level Changes

Change Details Files
Implemented Discord link via OAuth.
  • Added discord_id field to /datum/preferences.
  • Added new procs to handle Discord OAuth linking.
  • Added HTTP endpoints for retrieving and updating player Discord information.
  • Removed client-side Discord ID lookup and verification.
  • Added Discord OAuth login flow.
modular_bandastation/tts/code/SSHttp.dm
modular_bandastation/discord/code/discord.dm
modular_bandastation/metaserver/code/ss_central.dm
modular_bandastation/metaserver/code/discord_link.dm
Implemented a new whitelist system based on SS Central.
  • Added new procs and HTTP endpoints for managing the whitelist through SS Central.
  • Modified whitelist checking to use SS Central.
  • Added whitelist check to the interview process.
  • Added an admin verb to ban players from the whitelist.
modular_bandastation/tts/code/SSHttp.dm
code/modules/admin/whitelist.dm
modular_bandastation/metaserver/code/ss_central.dm
modular_bandastation/metaserver/code/interview.dm
modular_bandastation/metaserver/code/admin.dm
Refactored HTTP request logging.
  • Created new procs for logging HTTP requests and responses.
  • Moved logging logic to separate procs.
  • Added request ID to logs.
modular_bandastation/tts/code/SSHttp.dm
Implemented blocking HTTP requests.
  • Added make_blocking_request proc.
  • Implemented blocking HTTP request functionality using UNTIL.
modular_bandastation/tts/code/SSHttp.dm
Updated modpack metadata.
  • Updated modpack name and description for Discord integration.
  • Added metaserver modpack information.
modular_bandastation/discord/_discord.dm
modular_bandastation/metaserver/_metaserver.dm
Removed unused files and configurations.
  • Removed unused files related to the old whitelist system and configurations.
config/bandastation/bandastation_config.txt
modular_bandastation/modular_bandastation.dme
modular_bandastation/whitelist220/_whitelist220.dm
modular_bandastation/whitelist220/_whitelist220.dme
modular_bandastation/whitelist220/code/whitelist220.dm

Assessment against linked issues

Issue Objective Addressed Explanation
#191 Implement Discord account linking functionality
#191 Add Discord OAuth integration
#191 Provide a way to link Discord accounts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the 💾 Изменение конфига Ф-ф-фуриор...? label Dec 31, 2024
@Furrior Furrior linked an issue Dec 31, 2024 that may be closed by this pull request
@Furrior
Copy link
Collaborator Author

Furrior commented Jan 1, 2025

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Furrior - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • The 'req' variable is undefined in this scope. This will cause runtime errors when logging responses. (link)

Overall Comments:

  • The make_blocking_request() implementation using UNTIL is dangerous and could cause server hangs/deadlocks. Consider making this fully asynchronous instead.
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 1 other issue
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

modular_bandastation/tts/code/SSHttp.dm Outdated Show resolved Hide resolved
config/bandastation/bandastation_config.txt Show resolved Hide resolved
@Furrior
Copy link
Collaborator Author

Furrior commented Jan 1, 2025

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Furrior - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hardcoded SS_CENTRAL_TOKEN found. (link)

Overall Comments:

  • The blocking HTTP request using UNTIL is dangerous and could freeze the game if the request hangs. Consider using async requests consistently throughout the codebase.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

modular_bandastation/tts/code/SSHttp.dm Show resolved Hide resolved
modular_bandastation/tts/code/SSHttp.dm Outdated Show resolved Hide resolved
modular_bandastation/tts/code/SSHttp.dm Outdated Show resolved Hide resolved
config/bandastation/bandastation_config.txt Outdated Show resolved Hide resolved
@Furrior Furrior marked this pull request as ready for review January 1, 2025 09:15
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Furrior - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hardcoded SS_CENTRAL_TOKEN found. (link)

Overall Comments:

  • The make_blocking_request() method using UNTIL is dangerous and could cause deadlocks. Consider making this fully async or adding additional safeguards if blocking behavior is absolutely required.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

modular_bandastation/tts/code/SSHttp.dm Outdated Show resolved Hide resolved
config/bandastation/bandastation_config.txt Outdated Show resolved Hide resolved
@Furrior Furrior requested a review from Gaxeer January 1, 2025 09:21
Copy link

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the Stale label Jan 12, 2025
@dj-34 dj-34 added RED LABEL ПР не может быть устаревшим. Но всем всё равно на него похуй. 🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. 🛡️ Stale Exempt ПР не может быть устаревшим. Но всем всё равно на него похуй. and removed Stale RED LABEL ПР не может быть устаревшим. Но всем всё равно на него похуй. labels Jan 12, 2025
@Furrior Furrior marked this pull request as draft January 12, 2025 15:35
@github-actions github-actions bot removed the 🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💾 Изменение конфига Ф-ф-фуриор...? 🛡️ Stale Exempt ПР не может быть устаревшим. Но всем всё равно на него похуй.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Привязка Дискорда Синхронизировать бд
3 participants