Files
tbd-station-14/Content.Shared/CCVar/CCVars.Github.cs
beck-thompson a8d6dbc324 Added button and manager for in game bug reports (Part 1) (#35350)
* Added the button and manager

* Minor cleanup

* Reigstered to the wrong thing!

* Unload UI

* Address the review

* First commit :)

* Some cleanup

* Added some comments and now the placehoder text goes away once you start typing

* Some cleanup and better test command

* Basic rate limiter class (Not finished)

* Cleanup

* Removed forgotten comment xD

* Whitespace removal

* Minor cleanup, cvar hours -> minutes

* More minor tweaks

* Don't cache timer and add examples to fields

* Added CCvar for time between bug reports

* Minor crash when restarting rounds fixed

* It compiled on my computer!

* Fix comment indents

* Remove unecessary async, removed magic strings, simplfied sawmill to not use post inject

* Make struct private

* Simplfiy TryGetLongHeader

* Changed list to enumerable

* URI cleanup

* Got rid of the queue, used a much better way!

* Made the comments a little better and fix some issues with them

* Added header consts

* Maximum reports per round is now an error message

* Time between reports is now in seconds

* Change ordering

* Change hotkey to O

* only update window when its open

* Split up validation

* address review

* Address a few issues

* inheritance fix

* API now doesn't keep track of requests, just uses the rate limited response from github

* Rough idea of how channels would work

* refactor: reorganized code, placed rate limiter into http-client-handler AND manager (usually only manager-one should work)

* cleanup

* Add user agent so api doesn't get mad

* Better error logs

* Cleanup

* It now throws!

* refactor: renaming, moved some methods, xml-doc cleanups

* refactor: BugReportWindow formatted to convention, enforced 1 updates only 1 per sec

* Add very basic licence info

* Fixed the issues!

* Set ccvar default to false

* make the button better

* fix test fail silly me

* Adress the review!

* refactor: cleanup of entry point code, binding server-side code with client-facing manager

* Resolve the other issues and cleanup and stuff smile :)

* not entity

* fixes

* Cleanup

* Cleanup

* forgor region

* fixes

* Split up function and more stuff

* Better unsubs yaygit add -A

* I pray...

* Revert "I pray..."

This reverts commit 9629fb4f1289c9009a03e4e4facd9ae975e6303e.

* I think I have to add it in the pr

* Revert "I think I have to add it in the pr"

This reverts commit e185b42f570fe5f0f51e0e44761d7938e22e67f7.

* Tweaks

* Minor tweak to permissions

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
2025-08-15 09:10:38 -07:00

72 lines
3.3 KiB
C#

using Robust.Shared.Configuration;
namespace Content.Shared.CCVar;
public sealed partial class CCVars
{
/// <summary>
/// Marker, for if the GitHub api is enabled. If it is not enabled, any actions that require GitHub API will be ignored.
/// To fully set up the API, you also need to set <see cref="GithubAppPrivateKeyPath"/>, <see cref="GithubAppId"/>,
/// <see cref="GithubRepositoryName"/> and <see cref="GithubRepositoryOwner"/>.
/// </summary>
public static readonly CVarDef<bool> GithubEnabled =
CVarDef.Create("github.github_enabled", true, CVar.SERVERONLY);
/// <summary>
/// GitHub app private keys location. <b>PLEASE READ THIS CAREFULLY!!</b>
/// <list type="bullet">
/// <item>
/// Its highly recommend to create a new (private) repository specifically for this app. This will help avoid
/// moderation issues and also allow you to ignore duplicate or useless issues. You can just transfer legitimate
/// issues from the private repository to the main public one.
/// </item>
/// <item>
/// Only create the auth token with the MINIMUM required access (Specifically only give it access to one
/// repository - and the minimum required access for your use case).
/// <br/><br/>If this token is only for forwarding issues then you should only need to grant read and write
/// permission to "Issues" and read only permissions to "Metadata".
/// </item>
/// </list>
/// Also remember to use the <code>testgithubapi</code> command to test if you set everything up correctly.
/// [Insert YouTube video link with walkthrough here]
/// </summary>
/// <example>
/// (If your on linux): /home/beck/key.pem
/// </example>
public static readonly CVarDef<string> GithubAppPrivateKeyPath =
CVarDef.Create("github.github_app_private_key_path", "", CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// The GitHub apps app id. Go to https://github.com/settings/apps/APPNAME to find the app id.
/// </summary>
/// <example>
/// 1009555
/// </example>
public static readonly CVarDef<string> GithubAppId =
CVarDef.Create("github.github_app_id", "", CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// Name of the targeted GitHub repository.
/// </summary>
/// <example>
/// If your URL was https://github.com/space-wizards/space-station-14 the repo name would be "space-station-14".
/// </example>>
public static readonly CVarDef<string> GithubRepositoryName =
CVarDef.Create("github.github_repository_name", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// Owner of the GitHub repository.
/// </summary>
/// <example>
/// If your URL was https://github.com/space-wizards/space-station-14 the owner would be "space-wizards".
/// </example>
public static readonly CVarDef<string> GithubRepositoryOwner =
CVarDef.Create("github.github_repository_owner", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// The maximum number of times the api will retry requests before giving up.
/// </summary>
public static readonly CVarDef<int> GithubMaxRetries =
CVarDef.Create("github.github_max_retries", 3, CVar.SERVERONLY | CVar.CONFIDENTIAL);
}