Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
developers192 committed Apr 19, 2024
1 parent 083fc3b commit 0892726
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CLIENTID=MTExODA2MjcxMTY4Nzg3MjU5Mw==
16 changes: 9 additions & 7 deletions DetailedLoLRPC.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from lcu_driver import Connector
from utilities import isOutdated, GITHUBURL, CLIENTID, fetchConfig, procPath, resetLog, addLog, resourcePath
from utilities import isOutdated, GITHUBURL, CLIENTID, fetchConfig, procPath, resetLog, addLog, resourcePath, yesNoBox
from cdngen import *
from disabler import disableNativePresence
from pypresence import Presence
from time import time, sleep
from aiohttp import request
from os import _exit, system, path as op
from tray_icon import icon
from easygui import buttonbox
from multiprocessing import Process, freeze_support
from subprocess import Popen, PIPE
from nest_asyncio import apply
from json import loads
from asyncio import sleep as asyncSleep

if __name__ == "__main__":

Expand All @@ -26,8 +26,8 @@
# Check for updates
outdated = isOutdated()
if outdated:
choice = buttonbox(f"A newer version of DetailedLoLRPC detected ({outdated}). Do you want to visit the download site?", "DetailedLoLRPC", ("Yes", "No"), cancel_choice = "No", icon=resourcePath("icon.ico"))
if choice == "Yes":
choice = yesNoBox(f"A newer version of DetailedLoLRPC detected ({outdated}). Do you want to visit the download site?")
if choice:
system(f"start \"\" {GITHUBURL}")
sleep(1)
_exit(0)
Expand Down Expand Up @@ -77,7 +77,9 @@ async def connect(connection):

@connector.close
async def disconnect(_):
_exit(0)
await asyncSleep(1)
if not procPath("LeagueClient.exe"):
_exit(0)

@connector.ws.register("/lol-gameflow/v1/session", event_types = ("CREATE", "UPDATE", "DELETE"))
async def gameFlow(connection, event):
Expand Down Expand Up @@ -216,8 +218,8 @@ async def chatUpdate(connection, event):
isLeagueOpened = procPath("LeagueClient.exe")
choice = "NoStart"
if isLeagueOpened:
choice = buttonbox(f"DetailedLoLRPC might not work properly if opened after League of Legends. Continue?", "DetailedLoLRPC", ("Yes", "No"), cancel_choice = "No", icon=resourcePath("icon.ico"))
if choice == "No":
choice = yesNoBox("DetailedLoLRPC might not work properly if opened after League of Legends. Continue?")
if not choice:
_exit(0)

# Tray Icon
Expand Down
77 changes: 66 additions & 11 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@
from requests import get
from pickle import load, dump
from json import load as loadj, dump as dumpj
from easygui import enterbox
import tkinter as tk
from tkinter import messagebox, ttk
from dotenv import load_dotenv
from base64 import b64decode

VERSION = "v2.8"
def resourcePath(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = op.abspath(".")

return op.join(base_path, relative_path)


load_dotenv(resourcePath(".env"))

VERSION = "v2.9"
GITHUBURL = "https://github.com/developers192/DetailedLoLRPC/releases/latest"
ISSUESURL = "https://github.com/developers192/DetailedLoLRPC/issues/new"
DEFAULTCONFIG = {
Expand All @@ -17,15 +31,55 @@
}
CONFIGDIR = op.join(getenv("APPDATA"), "DetailedLoLRPC", "config.dlrpc")
LOGDIR = op.join(getenv("APPDATA"), "DetailedLoLRPC", "sessionlog.json")
CLIENTID = "1118062711687872593"
CLIENTID = b64decode(getenv("CLIENTID")).decode("utf-8")

def resourcePath(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = op.abspath(".")
def yesNoBox(msg):
root = tk.Tk()
root.withdraw()
root.iconbitmap(resourcePath("icon.ico"))

return op.join(base_path, relative_path)
result = messagebox.askyesno("DetailedLoLRPC", msg)
return result

def inputBox(msg):
root = tk.Tk()
root.withdraw()

dialog = tk.Toplevel(root)
dialog.title("DetailedLoLRPC")
dialog.geometry("360x150")
dialog.resizable(False, False)
dialog.iconbitmap(resourcePath("icon.ico"))

label = tk.Label(dialog, text= msg, wraplength=300)
label.pack(pady=10)

entry = tk.Entry(dialog, width=50)
entry.pack(pady=5)

button_frame = tk.Frame(dialog)
button_frame.pack(pady=10)

def on_yes():
global result
result = "-1"
result = entry.get()
dialog.destroy()

yes_button = ttk.Button(button_frame, text="Confirm", style="Windows.TButton", command=on_yes)
yes_button.pack(side=tk.LEFT, padx=5)

def on_no():
global result
result = None
dialog.destroy()
dialog.protocol("WM_DELETE_WINDOW", on_no)

no_button = ttk.Button(button_frame, text="Cancel", style="Windows.TButton", command=on_no)
no_button.pack(side=tk.LEFT, padx=5)

dialog.wait_window(dialog)
return result

def procPath(name):
for proc in pi():
Expand Down Expand Up @@ -53,13 +107,14 @@ def getRiotPath():
if path:
path = op.dirname(op.dirname(path))
else:
path = enterbox(r'Riot Services process was not found. Please enter the path to the "Riot Games" folder below (E.g. C:\Riot Games)', "DetailedLoLRPC")
n = "\n"
path = inputBox(rf'Riot Services process was not found. Please enter the path to the "Riot Games" folder below{n}(E.g. C:\Riot Games)')
while True:
if path is None:
_exit(0)
if checkRiotClientPath(path):
break
path = enterbox(r'Invalid Path. Please enter the path to the "Riot Games" folder below (E.g. C:\Riot Games)', "DetailedLoLRPC")
path = inputBox(r'Invalid Path. Please enter the path to the "Riot Games" folder below (E.g. C:\Riot Games)')
return path

def fetchConfig(entry):
Expand Down

0 comments on commit 0892726

Please sign in to comment.