From 5cde9f9a654b3fdc9b474a0f7cd2219874ad0ecc Mon Sep 17 00:00:00 2001 From: Sirius B <87911136+SiriusBYT@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:05:06 +0200 Subject: [PATCH] Flashcord Store Update --- .vscode/extensions.json | 7 - .vscode/settings.json | 4 - FlashCFG.json | 20 -- FlashCFG.py | 338 +++++++++--------- README.md | 2 + description.html | 6 + .../siriusbyt/themehooker-files/embed.html | 53 ++- .../store/plugins/siriusbyt/themehooker.html | 280 +++++++-------- .../default/default-embed_template.html | 65 ++-- .../default/default-plugin_template.html | 264 +++++++------- manifest.json | 21 +- 11 files changed, 501 insertions(+), 559 deletions(-) delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json delete mode 100644 FlashCFG.json create mode 100644 description.html diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 23d8e87..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "dbaeumer.vscode-eslint", - "EditorConfig.EditorConfig", - "esbenp.prettier-vscode" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9bf4d12..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true -} diff --git a/FlashCFG.json b/FlashCFG.json deleted file mode 100644 index 5b1e7a8..0000000 --- a/FlashCFG.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ThemeHooker", - "long_description": "
Fine. I'll fucking do it myself. Adds Discord's custom themes' name inside the html and body tag so that Theme Developers can do funny shenanigans.\n This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it.
\nThis plugins add a new attribute to the html and body tag named 'theme-hooker'.
\nWhen no custom nitro themes are detected, the attribute's default value is 'theme-null'.
\nWhen ThemeHooker detects a theme, it simply adds 'theme-[name of nitro theme]'.
\nPlease note that the Candyfloss theme is actually named 'theme-cotton-candy' and the Memory Lane theme is actually named 'theme-easter-egg'.
", - "short_description": "This store page was created using the Flashcord Store Quick Config Python Script!", - "version": "v1.1.0", - "author": "SiriusBYT", - "contributors": "Catalyst4222, Tharki-God", - "github_repo": "https://github.com/SiriusBYT/ThemeHooker", - "img_store": "store-banner.png", - "img_embed": "embed-banner.png", - "license": "CC-BY-ND-NC 4.0", - "license_year": "2023-2024", - "is_rpplugin": true, - "is_rptheme": false, - "images_are_full_links": false, - "internal_name": "themehooker", - "discord_link": "https://sirio-network.com/redirect/discord", - "sndl_theme": "Light", - "embed_color": "#FF69FF" -} \ No newline at end of file diff --git a/FlashCFG.py b/FlashCFG.py index 61f2620..749f681 100644 --- a/FlashCFG.py +++ b/FlashCFG.py @@ -1,190 +1,178 @@ from Flashcord_API_Client import * -import json +import json, time """ This tool lets you quickly configure your page in a hurry. Read https://github.com/SiriusBYT/Flashcord/wiki/The-Flashcord-Store-Template for how this file works. -WARNING: If you are quickly generating a page from a Replugged Addon's manifest JSON, -Make SURE to first run "ManifestHooker.py" and then manually verify the information inside the generated "FlashCFG_ManifestHooker.json" file. -Then you can rename the generated JSON file to simply "FlashCFG.json" and THEN you can ultimately finally run this script. +This allows the script to connect to the SGN servers in order to make your store page more complete without user input +It's now probably not a good idea to disable this. """ +AllowAPI = True; Debug = True + +# Logging System + Getting current time and date in preferred format +def GetTime(): + CTime = time.localtime() + Time = f"{CTime.tm_hour:02d}:{CTime.tm_min:02d}:{CTime.tm_sec:02d}" + Date = f"{CTime.tm_mday:02d}-{CTime.tm_mon:02d}-{CTime.tm_year}" + return Time,Date +def WriteLog(Log): + Time,Date = GetTime() + PrintLog = f"[{Time} - {Date}] {Log}" + print(PrintLog) + -# Edit the following things -AllowAPI = True # Allows the script to connect to the SGN servers in order to make your store page more complete without user input - -with open("FlashCFG.json", "r", encoding="utf-8") as FlashCFG: - FlashCFG_JSON = json.load(FlashCFG) - Name = FlashCFG_JSON["name"] - Long_Description = FlashCFG_JSON["long_description"] - Short_Description = FlashCFG_JSON["short_description"] - Version = FlashCFG_JSON["version"] - GitHub_Profile = FlashCFG_JSON["author"] - GitHub_Contributors = FlashCFG_JSON["contributors"] - GitHub_Repo = FlashCFG_JSON["github_repo"] - Store_Embed_FileName = FlashCFG_JSON["img_store"] - Embed_FileName = FlashCFG_JSON["img_embed"] - License = FlashCFG_JSON["license"] - License_Year = FlashCFG_JSON["license_year"] - - isRepluggedPlugin = FlashCFG_JSON["is_rpplugin"] - isFlashcordCompetitor = FlashCFG_JSON["is_rptheme"] - areIMGsFullLinks = FlashCFG_JSON["images_are_full_links"] - - Folder_Name = f"{FlashCFG_JSON["internal_name"]}-files" - Store_Page_Name = f"{FlashCFG_JSON["internal_name"]}.html" - Discord = FlashCFG_JSON["discord_link"] - SNDL_Theme = FlashCFG_JSON["sndl_theme"] - Embed_Color = FlashCFG_JSON["embed_color"] - - GitHub_RepoID = GitHub_Repo.split("/") - GitHub_RepoID = GitHub_RepoID[-1] - - #print(f"DATA LOADED: {Name} \n{Long_Description}\n {Short_Description} {Version} {GitHub_Profile} {GitHub_Contributors} {GitHub_Repo} {Store_Embed_FileName} {Embed_FileName} {License} {License_Year} {isRepluggedPlugin} {isFlashcordCompetitor} {areIMGsFullLinks} {Folder_Name} {Store_Page_Name} {Discord} {SNDL_Theme} {Embed_Color}") - - - -# NOT recommended to modify, do this only if you know what you're doing! -if isRepluggedPlugin == True: StoreTemplate = "flashcord/store/templates/default/default-plugin_template.html" -elif isFlashcordCompetitor == True: StoreTemplate = "flashcord/store/templates/default/default-theme_template.html" -else: StoreTemplate = "flashcord/store/templates/default/default-module_template.html" - -if areIMGsFullLinks == False: - Store_Banner = f"{Folder_Name}/{Store_Embed_FileName}" - -EmbedTemplate = "flashcord/store/templates/default/default-embed_template.html" -# Don't touch this, it will get overwritten anyways but still. Don't touch just in case. -HTMLFile = "" -# Don't touch this either. This will cause problems if your store page is for a Flashcord Module! -UserFolderName = GitHub_Profile.lower() - -def GetEmbedCode(): - HTMLCode = '' - API_Folders = [] - def CallAPI(): - if isRepluggedPlugin == True: API_Request = "GET/" + "PLUGINS/" + GitHub_Profile.upper() - elif isFlashcordCompetitor == True: API_Request = "GET/" + "THEMES/" + GitHub_Profile.upper() - else: API_Request = "GET/" + "MODULES/" + GitHub_Profile.upper() - RequestResults = Flashcord_API_Client(API_Request) - return RequestResults - API_Folders = CallAPI() - #print("TYPE:",type(API_Folders)) - #print("DATA:",API_Folders) +def ConfigLoader(): + global Addon_Name, Addon_DescriptionShort, Addon_Version, Addon_Repository, Addon_Author, Addon_License, Addon_Type, Addon_Contributors, Addon_Discord, Addon_Year, Addon_Theme, Addon_Color, Addon_Tags, Addon_Folder, Addon_ImageStore, Addon_ImageEmbed, Addon_Backup, Addon_DescriptionLong, Addon_LicenseString, Store_Template, Embed_Template, Username, Store_File, Embed_File, Type_Folder, Addon_Other, Addon_RepositoryName, Addon_TagsString + WriteLog("Fetching all informations required for the Addon Page...") + with open("manifest.json", "r", encoding="utf8") as Manifest_File: Manifest_JSON = json.load(Manifest_File) + # Collect all the information from the Vanilla Replugged Manifest + Addon_Name = Manifest_JSON["name"] + Addon_DescriptionShort = Manifest_JSON["description"] + Addon_Version = Manifest_JSON["version"] + Addon_Repository = Manifest_JSON["source"] + Temporary = Addon_Repository.split("/") + Addon_Author = Temporary[-2] # This looks janky but this is the best way to get the author name like I want it. + Addon_RepositoryName = Temporary[-1] + Addon_License = Manifest_JSON["license"] + Addon_Type = Manifest_JSON["type"] + + # Collect all the information from the Flashcord Store Manifest + Flashcord_Key = Manifest_JSON["flashcord"] + Flashcord_General = Flashcord_Key["general_information"] + Flashcord_Internal = Flashcord_Key["internal_structure"] + # General Information + Addon_Contributors = Flashcord_General["contributors"] + Addon_Discord = Flashcord_General["discord_link"] + Addon_Year = Flashcord_General["license_year"] + Addon_Theme = Flashcord_General["sndl_theme"] + Addon_Color = Flashcord_General["embed_color"] + Addon_Tags = Flashcord_General["tags"] + # Internal Information + Addon_Folder = Flashcord_Internal["internal_name"] + Addon_ImageStore = Flashcord_Internal["image_store"] + Addon_ImageEmbed = Flashcord_Internal["image_embed"] + Addon_Backup = Flashcord_Internal["backup_files"] + + # Get the HTML for the Long Description + with open("description.html") as Description_File: Addon_DescriptionLong = Description_File.read() + + WriteLog("Processing Information...") + Addon_TagsString = str(Addon_Tags).replace("[","").replace("]","").replace('"','').replace("'","") + Addon_LicenseString = f"{Addon_Author} © {Addon_Year} - {Addon_Name} | {Addon_License}" + Username = Addon_Author.lower() + match Addon_Type: + case "replugged-plugin": + Store_Template = "flashcord/store/templates/default/default-plugin_template.html" + Type_Folder = "plugins" + case "replugged-theme": + Store_Template = "flashcord/store/templates/default/default-theme_template.html" + Type_Folder = "themes" + case _: + Store_Template = "flashcord/store/templates/default/default-module_template.html" + Type_Folder = "modules" + Embed_Template = "flashcord/store/templates/default/default-embed_template.html" + Store_File = f"flashcord/store/{Type_Folder}/{Username}/{Addon_Folder}.html" + Embed_File = f"flashcord/store/{Type_Folder}/{Username}/{Addon_Folder}-files/embed.html" + + # Call the Flashcord API to get all other addons made by the author (Warning: code is bad and ugly) + API_Folders = Flashcord_API_Client(f"GET/{Type_Folder.upper()}/{Username.upper()}"); Addon_Other = "" if API_Folders != None: API_Folders = API_Folders.replace("[","").replace("]","").replace('"','').replace("'","").replace(' ','').split(",") for cycle in range (len(API_Folders)): API_Folders[cycle] = API_Folders[cycle] + "-files" - if Folder_Name in API_Folders: - API_Folders.remove(Folder_Name) - for cycle in range (len(API_Folders)): - HTMLCode = HTMLCode + f'\n' - else: - HTMLCode = HTMLCode + f'\n' - return HTMLCode - -# This code is disgusting but it works, will optimize when I feel like it. -# NOTICE: this has ZERO error handling (or very little)! This is fucking horrible but I don't know yet how to do those and at the time of writing it's fucking 23h28 -def GetHTMLFile(FileConcerned): - if FileConcerned == "Store Page": - if isRepluggedPlugin == True: - File = "flashcord/store/plugins/" + GitHub_Profile.lower() + "/" + Store_Page_Name + if Addon_Folder in API_Folders: API_Folders.remove(Addon_Folder) # We don't want duplicates! + if API_Folders == []: Addon_Other = "Fine. I'll fucking do it myself. Adds Discord's custom themes' name inside the html and body tag so that Theme Developers can do funny shenanigans. + This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it.
+This plugins add a new attribute to the html and body tag named 'theme-hooker'.
+When no custom nitro themes are detected, the attribute's default value is 'theme-null'.
+When ThemeHooker detects a theme, it simply adds 'theme-[name of nitro theme]'.
+Please note that the Candyfloss theme is actually named 'theme-cotton-candy' and the Memory Lane theme is actually named 'theme-easter-egg'.
\ No newline at end of file diff --git a/flashcord/store/plugins/siriusbyt/themehooker-files/embed.html b/flashcord/store/plugins/siriusbyt/themehooker-files/embed.html index f5f09e2..e1fb79a 100644 --- a/flashcord/store/plugins/siriusbyt/themehooker-files/embed.html +++ b/flashcord/store/plugins/siriusbyt/themehooker-files/embed.html @@ -1,39 +1,30 @@ - +This store page was created using the Flashcord Store Quick Config Python Script!
-SiriusBYT © 2023-2024 - ThemeHooker | CC-BY-ND-NC 4.0
+Fine. I'll fucking do it myself, because nobody else did. Adds Discord's custom themes' name inside the and
tag so that Theme Developers can do funny shenanigans. This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it. +SiriusBYT © 2023-2024 - ThemeHooker | CC BY-NC-ND 4.0
Fine. I'll fucking do it myself. Adds Discord's custom themes' name inside the html and body tag so that Theme Developers can do funny shenanigans. - This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it.
-This plugins add a new attribute to the html and body tag named 'theme-hooker'.
-When no custom nitro themes are detected, the attribute's default value is 'theme-null'.
-When ThemeHooker detects a theme, it simply adds 'theme-[name of nitro theme]'.
-Please note that the Candyfloss theme is actually named 'theme-cotton-candy' and the Memory Lane theme is actually named 'theme-easter-egg'.
-This store page was created using the Flashcord Store Quick Config Python Script!
- - - -Theses plugins are NOT APPROVED ON THE REPLUGGED STORE, the Flashcord Store does NOT CONTROL the code being ran from these plugins.
-In other words, these plugins have not been confirmed if they are malicious or not. Even if they do work as intended one day, it doesn't mean that after an update it will be still sunshines and roses.
-Fine. I'll fucking do it myself. Adds Discord's custom themes' name inside the html and body tag so that Theme Developers can do funny shenanigans. + This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it.
+This plugins add a new attribute to the html and body tag named 'theme-hooker'.
+When no custom nitro themes are detected, the attribute's default value is 'theme-null'.
+When ThemeHooker detects a theme, it simply adds 'theme-[name of nitro theme]'.
+Please note that the Candyfloss theme is actually named 'theme-cotton-candy' and the Memory Lane theme is actually named 'theme-easter-egg'.
+Fine. I'll fucking do it myself, because nobody else did. Adds Discord's custom themes' name inside the and
tag so that Theme Developers can do funny shenanigans. This is made mostly only for Flashcord, no support for other themes may be provided unless I feel like it. - - -Theses plugins are NOT APPROVED ON THE REPLUGGED STORE, the Flashcord Store does NOT CONTROL the code being ran from these plugins.
+In other words, these plugins have not been confirmed if they are malicious or not. Even if they do work as intended one day, it doesn't mean that after an update it will be still sunshines and roses.
SiriusBYT © 2023-2024 - ThemeHooker | CC BY-NC-ND 4.0
+SiriusBYT © 2023-2024 - ThemeHooker | CC-BY-ND-NC 4.0
-SiriusBYT © 2023-2024 - Sirio Network Website | CC-BY-ND-NC 4.0
-SiriusBYT © 2023-2024 - Sirio Network Website | CC-BY-ND-NC 4.0
+[SHORT_DESC]
-[GITHUB_PROFILE] © [LICENSE_YEAR] - [NAME] | [LICENSE]
+[Addon_DescriptionShort]
+[Addon_LicenseString]
[LONG_DESC]
-[SHORT_DESC]
- - - -Theses plugins are NOT APPROVED ON THE REPLUGGED STORE, the Flashcord Store does NOT CONTROL the code being ran from these plugins.
-In other words, these plugins have not been confirmed if they are malicious or not. Even if they do work as intended one day, it doesn't mean that after an update it will be still sunshines and roses.
-[Addon_DescriptionLong]
+[Addon_DescriptionShort]
- - -Theses plugins are NOT APPROVED ON THE REPLUGGED STORE, the Flashcord Store does NOT CONTROL the code being ran from these plugins.
+In other words, these plugins have not been confirmed if they are malicious or not. Even if they do work as intended one day, it doesn't mean that after an update it will be still sunshines and roses.
[Addon_LicenseString]
+[GITHUB_PROFILE] © [LICENSE_YEAR] - [NAME] | [LICENSE]
-SiriusBYT © 2023-2024 - Sirio Network Website | CC-BY-ND-NC 4.0
-SiriusBYT © 2023-2024 - Sirio Network Website | CC-BY-ND-NC 4.0
+