Skip to content

Commit

Permalink
RELEASE THE GATES
Browse files Browse the repository at this point in the history
  • Loading branch information
nyxical420 committed Nov 15, 2024
1 parent 32abdca commit 06a3579
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 22 deletions.
2 changes: 1 addition & 1 deletion assets/scripts/modlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function generateModItems(modData) {

// Add download count and score
const downloadsDiv = document.createElement('div');
downloadsDiv.style = "font-size: 18px;";
downloadsDiv.style = "font-size: 20px;";
downloadsDiv.innerHTML = `
<img src="/assets/web/download.png" style="vertical-align: middle; width: 22px; height: 22px;"/> ${mod.totalDownloads.toLocaleString()}
<img src="/assets/web/like.png" style="vertical-align: middle; width: 22px; height: 22px;"/> ${mod.modScore.toLocaleString()}
Expand Down
3 changes: 0 additions & 3 deletions data/config.json

This file was deleted.

14 changes: 10 additions & 4 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
</div>
</div>

<div id="creditsMenu" class="settingTab">
<div id="creditsMenu" class="settingTab" style="font-size: 18px;">
<text>Credits to Zoiudolo for the Rod n' Mod Banner, Icons, Point & Click cursors</text><br>
<text>westwerst for the Game Sounds & Cursor</text>
</div>
Expand Down Expand Up @@ -200,9 +200,15 @@
</div>
</div>

<button type="normalButton" style="width: 150px; margin-left: auto;" onmouseup="handleChange()">
<text style="pointer-events: none;">REFRESH MODS</text>
</button>
<div style="margin-left: auto;">
<button type="normalButton" style="width: 125px;" onmouseup="window.pywebview.api.updateAllMods()">
<text style="pointer-events: none;">UPDATE MODS</text>
</button>

<button type="normalButton" style="width: 140px;" onmouseup="handleChange()">
<text style="pointer-events: none;">REFRESH MODS</text>
</button>
</div>
</div>
</div>

Expand Down
47 changes: 38 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from json import load, dump
from rapidfuzz import fuzz, process
from webbrowser import open as openWeb
from os import path, rename, walk, chdir
from re import IGNORECASE, compile as comp
from psutil import process_iter, NoSuchProcess
from os import path, rename, walk, chdir, listdir
from webview import create_window, start, windows as webWindows

from rodnmod.fishfinder import findWebfishing
Expand Down Expand Up @@ -55,11 +55,18 @@ def launchWebfishing(self, vanilla: bool = False):
def configure(self, configItem: str, configValue = None):
configPath = "data/config.json"
if not path.exists(configPath):
default_config = {"debugging": "debdis"}
default_config = {
"debugging": "debdis",
"hlsmods": "findhls",
"reelsound": "reel",
"transition": "transition",
"filter": "installed",
"category": "all",
"nsfw": "hidensfw"
}
with open(configPath, 'w') as file:
dump(default_config, file, indent=4)

# If config file exists, load it
with open(configPath) as file:
config = load(file)

Expand Down Expand Up @@ -270,12 +277,12 @@ def downloadMod(self, mod: str):
if dependencyPath:
try:
with open(dependencyPath + "\\rnmInfo.json", "r") as f:
mnrInfo = load(f)
rnmInfo = load(f)
except:
# cant do anything about this, probbably a mod installed via HLS.
mnrInfo = {"version": "1.0.0"}
rnmInfo = {"version": "1.0.0"}

if mnrInfo["version"] != dependencyVersion:
if rnmInfo["version"] != dependencyVersion:
download(dependencyDownload, installationPath + "\\GDWeave\\mods", {"name": dependencyName, "author": dependencyAuthor, "version": dependencyVersion})

else:
Expand All @@ -288,15 +295,15 @@ def downloadMod(self, mod: str):
try:
if modPath != None:
with open(modPath + "\\rnmInfo.json", "r") as f:
mnrInfo = load(f)
rnmInfo = load(f)

if mnrInfo["version"] != modVersion:
if rnmInfo["version"] != modVersion:
download(modDownload, installationPath + "\\GDWeave\\mods", {"name": modName, "author": modAuthor, "version": modVersion})
window.evaluate_js(f"notify('{modName} has been updated successfully!', 3000)")
else:
window.evaluate_js(f"notify('{modName} is currently up to date!', 3000)")

except FileNotFoundError: # mnrInfo.json missing, skip version check and download mod immediately instead
except FileNotFoundError: # rnmInfo.json missing, skip version check and download mod immediately instead
window.evaluate_js(f"notify('rnmInfo.json for {modName} missing. Forcing download...', 3000)")
download(modDownload, installationPath + "\\GDWeave\\mods", {"name": modName, "author": modAuthor, "version": modVersion})

Expand Down Expand Up @@ -330,6 +337,28 @@ def uninstallMod(self, mod: str, checkExists: bool = False):
except PermissionError:
window.evaluate_js(f"notify('Permission denied! Please close WEBFISHING first to uninstall the mod!', 3000)")

def updateAllMods(self):
window.evaluate_js(f"notify('Updating Mods...', 3000)")
fpath = installationPath + "\\GDWeave\\mods"
folders = [entry for entry in listdir(fpath) if path.isdir(path.join(fpath, entry))]

for mod in folders:
try: mod = mod.split(".")[1]
except IndexError: pass
_, value = next(iter(self.searchModList(mod, "none", "all", "shownsfw").items()))

try:
with open(f"{fpath}\\" + value.get("modAuthor") + "." + value.get("modName") + "\\rnmInfo.json", "r") as f:
modInfo = load(f)
except FileNotFoundError:
modInfo = {"version": "null"}

if value.get("latestVersion") != modInfo["version"]:
self.downloadMod(value.get("modAuthor") + "-" + value.get("modName"))

window.evaluate_js(f"notify('Updated all mods!', 3000)")


rnm = RodNMod()

if __name__ == "__main__":
Expand Down
4 changes: 1 addition & 3 deletions rodnmod/fishfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ def findWebfishing():
if path.isfile(path.join(installationPath, "webfishing.exe")):
return installationPath

return None

print(findWebfishing())
return None
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
setup(
name="Rod n' Mod",
version=version,
description="A webfishing-themed mod manager!",
description="Rod n' Mod",
options={
"build_exe": {
"include_files": include_files,
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.3.0-alpha"
"version": "1.3.1-alpha"
}

0 comments on commit 06a3579

Please sign in to comment.