diff --git a/index.css b/index.css index b9fc013..61878c0 100644 --- a/index.css +++ b/index.css @@ -162,4 +162,71 @@ button:active { display: flex; justify-content: center; align-items: center; -} \ No newline at end of file +} + +/*.settings { + position: fixed; + background-color: #000000; + width: 80%; + height: 69%; + inset: 0; +} +*/ +.settings { + position: fixed; + width: 80%; + height: 80%; + padding: 0px; + margin: auto; + inset: 0px; + display: flex; + flex-direction: column; + backdrop-filter: blur(20px) brightness(40%); + border-radius: 20px; + box-shadow: 0px 0px 20px #00000055; + z-index: 7; /* i like the number 7 */ + opacity: 0; + scale: 0.8; + pointer-events: none; +} + +@keyframes popup { + from { + scale: 0.8; + opacity: 0; + pointer-events: none; + } + to { + scale: 1; + opacity: 1; + pointer-events: all; + } +} + +.popup { + animation: popup 0.5s ease-out forwards; +} + +@keyframes popout { + from { + scale: 1; + opacity: 1; + pointer-events: all; + } + to { + scale: 0.8; + opacity: 0; + pointer-events: none; + } +} + +.popout { + animation: popout 0.5s ease-in forwards; +} + +.settingsiframe { + width: 100%; + height: 100%; + border: 0; + border-radius: 20px; +} \ No newline at end of file diff --git a/index.html b/index.html index 1297b20..7d2f688 100644 --- a/index.html +++ b/index.html @@ -3,14 +3,18 @@ zdkrimson + +
+ +
-
diff --git a/index.js b/index.js new file mode 100644 index 0000000..c8107a9 --- /dev/null +++ b/index.js @@ -0,0 +1,25 @@ +function settings(status) { + var settingsmenu = document.getElementById("settings"); + + if (status == "show") { + settingsmenu.classList.add("popup"); + settingsmenu.classList.remove("popout"); + } + + if (status == "hide") { + settingsmenu.classList.remove("popup"); + settingsmenu.classList.add("popout"); + } +} + +// Listen for messages from iframe +window.addEventListener('message', function(event) { + // Verify origin of the iframe (optional, for security) + // if (event.origin !== 'https://your-iframe-domain.com') return; + + // Check the message received from iframe + if (event.data === 'hideSettings') { + // Call settings function in the parent window + settings('hide'); + } +}); diff --git a/main.py b/mainold.py similarity index 97% rename from main.py rename to mainold.py index 1027c11..a889dae 100644 --- a/main.py +++ b/mainold.py @@ -1,447 +1,447 @@ -import subprocess -import customtkinter -from nicegui import ui -import os -from threading import Timer -from os import path -import pyngrok -import json -import requests -import shutil -import schedule -import errno -from subprocess import Popen -from PIL import Image -from tkinter import messagebox - -# Themes -customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light" -customtkinter.set_default_color_theme("krimson.json") # Themes: "blue" (standard), "green", "dark-blue" -ui.query('body').style('background-color: #630000') -ui.colors(primary='#bf3a3a') - -# check if portablemc module is installed, if not install it -try: - import portablemc -except ModuleNotFoundError as e: - def dlmodule(): - def checkmodule(): - try: - import portablemc - print("works!") - messagebox.showinfo("Module Installed", "The 'portablemc' Module has successfully been installed!!!\nzdkrimson will now launch.\nIf Minecraft doesn't launch try 'pip freeze' in your terminal and look for 'portablemc' in the list of installed Python modules, if it isn't then try 'pip install portablemc' in your terminal.\nzdkrimson will now close so you may reopen it if you'd like.") - nomod.destroy() - except ModuleNotFoundError as e: - print("Retrying in 3 seconds...") - Timer(3, checkmodule).start() - subprocess.Popen("pip install portablemc") - nmtitle.configure(text="\n\nInstalling...") - nmmsg.configure(text="\n\n'portablemc' Module is being installed...\nPlease Wait") - nmbtn.pack_forget() - checkmodule() - - print("Missing Module! 'portablemc' Module is missing!") - - nomod = customtkinter.CTk() - nomod.geometry("700x600") - nomod.title("zdkrimson : Minecraft Launcher - Required Module not Installed!") - nomod.iconbitmap("zdicon.ico") - mainframen = customtkinter.CTkFrame(master=nomod, fg_color="#3D0A11") - mainframen.pack(pady=0, padx=0, fill="both", expand=True) - - nmtitle = customtkinter.CTkLabel(master=mainframen, text="\n\nOh No!") - nmtitle.pack(pady=0, padx=0) - - nmframe = customtkinter.CTkFrame(master=mainframen, fg_color="#630000") - nmframe.pack(pady=20, padx=40, fill="both", expand=True) - - nmmsg = customtkinter.CTkLabel(master=nmframe, text="\n\nThe 'portablemc' Module has not been found\non your system!") - nmmsg.pack(pady=0, padx=0) - - nmbtn = customtkinter.CTkButton(master=nmframe, text="Install Module (Requires Python Installed!)", command=dlmodule) - nmbtn.pack(padx=20, pady=10) - - nomod.mainloop() - - - - - -print(r""" - _ _ _ - | || | (_) - ____ __| || | __ _ __ _ _ __ ___ ___ ___ _ __ -|_ / / _` || |/ /| '__|| || '_ ` _ \ / __| / _ \ | '_ \ - / / | (_| || < | | | || | | | | |\__ \| (_) || | | | -/___| \__,_||_|\_\|_| |_||_| |_| |_||___/ \___/ |_| |_| - Written by ItsIceCreeperPE Dev & Artsign - - """) - -appdata=path.expandvars(r'%APPDATA%') -print("{}\\.minecraft".format(appdata)) -authtype=0 -CDDIR=os.getcwd() -global lastcrack -global firstime -global __version__ -lastcrack="" -firstime=0 -__version__="alpha5" -instances=[] -print(CDDIR) -global zdusername -global zdemail -global zduuid -zdusername="" -zdemail="" -zduuid="" - -# File/Folder Checking -if os.path.exists(".zdkrimson")==False: - print(".zdkrimson folder doesn't exist, created one just now.") - os.mkdir(".zdkrimson") - -if os.path.exists(".zdkrimson\\crackedusers")==False: - print("crackedusers folder doesn't exist, created one just now.") - os.mkdir("{}\\.zdkrimson\\crackedusers".format(CDDIR)) - -if os.path.exists(".zdkrimson\\settings.json")==False: - print("settings file(settings.json) doesn't exist, created one just now.") - config = { - "lastcrack": "", - "firsttime": 1, - "lastinstance": "" - } - configjson = json.dumps(config, indent=2) - with open(".zdkrimson\\settings.json", "w") as outfile: - outfile.write(configjson) - lastcrack="" - firstime=1 - lastinstance="" - -if os.path.exists(".zdkrimson\\instances")==False: - print("instances folder doesn't exist, created one just now.") - os.mkdir(".zdkrimson\\instances") - -# loading json files -with open('.zdkrimson\\settings.json', 'r') as openfile: - configjson = json.load(openfile) - try: - print(configjson['lastcrack']) - print(configjson['firsttime']) - print(configjson['lastinstance']) - lastcrack=configjson['lastcrack'] - firsttime=configjson['firsttime'] - lastinstance=configjson['lastinstance'] - print("imported settings json") - print(lastcrack) - except KeyError: - print("Settings file isn't up-to-date") - config = { - "lastcrack": "", - "firsttime": 1, - "lastinstance": "" - } - configjson = json.dumps(config, indent=2) - with open(".zdkrimson\\settings.json", "w") as outfile: - outfile.write(configjson) - lastcrack="" - firstime=1 - lastinstance="" - -splash = customtkinter.CTk() -splash.title("zdkrimson : Minecraft Launcher - Starting") -splash.geometry("350x262") -splash.overrideredirect(True) -splash.eval('tk::PlaceWindow . center') - -splashScreen = customtkinter.CTkImage(dark_image=Image.open("assets/splashScreen.png"), size=(350, 262)) - -splashimg = customtkinter.CTkLabel(master=splash, text="", image=splashScreen, justify=customtkinter.LEFT) -splashimg.pack(side=customtkinter.LEFT, pady=0, padx=0) - -@ui.page('/home') -def main_win(): - splash.destroy() - - # image loading - crim1 = "assets/bg/blur/crim1.png" - whitelogoshaded = "assets/logo/image/shaded/white.png" - whitetextshaded = "assets/logo/full/white.png" - amlshaded = "assets/logo/sub/shaded/white.png" - - def move_app(e): - app.geometry(f'+{e.x_root}+{e.y_root}') - - def quit(): - app.quit() - - def download(): - minecraft_directory = str(path.get()) - print(str(path.get())) - minecraft_launcher_lib.install.install_minecraft_version(version.get(), minecraft_directory) - - def play(): - print("text") - - @ui.page('/login') - def loginscrn(): - def selectedauth(value): - if value=="Microsoft": - usermaills.configure(placeholder_text="E-Mail") - authtype="Microsoft" - print(authtype) - uuidls.pack_forget() - else: - usermaills.configure(placeholder_text="Username") - uuidls.pack_forget() - - if value=="Cracked/Offline Mode": - authtype="Cracked/Offline Mode" - print(authtype) - logls.pack_forget() - uuidls.pack(pady=10, padx=10) - logls.pack(padx=20, pady=0) - - def login(): - zdusername=userls - zdemail=maills - zduuid=uuidls - zdoption=authtypeop - print(zdusername) - print(zdemail) - print(zduuid) - print(zdoption) -# print(authtype) -# print(authtypeop) - if zdoption=="Microsoft": - with ui.dialog() as dialog, ui.card(): - ui.markdown('**Notice!**') - ui.label("The Application will stop responding until the authentication as been completed.\nThe Authentication page should open in your default browser.\nClick 'OK' to continue the authentication process.\nClick 'Escape' on your keyboard to cancel.") - ui.button('OK', on_click=dialog.close) - dialog.open() - loginprocms=subprocess.call("{}\\portablemc login -m {}".format(CDDIR, zdemail)) - print(loginprocms) - if loginprocms==14: - ui.notify("Your Microsoft account doesn't have a legitmate copy of Minecraft.", closeBtn="OK") - else: - ui.notify("You own Minecraft, you are logged in!", closeBtn="OK") - user = { - "name": "{}".format(zdemail), - "uuid": "microsoft" - } - jsonfilezd = json.dumps(user, indent=2) - with open(".zdkrimson\\crackedusers\\{}.json".format(zdemail), "w") as outfile: - outfile.write(jsonfilezd) - cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a") - print(cadb) - cadb.write("{}\n".format(zdemail)) - cadb.close() - elif zdoption=="Cracked/Offline Mode": -# loginprocco=subprocess.call("{}\\portablemc -u {} -u {}".format(CDDIR, zdemail, zduuid)) - lastcrack=zdusername - user = { - "name": "{}".format(zdusername), - "uuid": "{}".format(zduuid) - } - jsonfilezd = json.dumps(user, indent=2) - with open(".zdkrimson\\crackedusers\\{}.json".format(zdusername), "w") as outfile: - outfile.write(jsonfilezd) - ui.notify("You are logged in as {} as a Cracked/Offline Mode Player.".format(zdusername), closeBtn="OK") - cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a") - print(cadb) - cadb.write("{}\n".format(zdusername)) - cadb.close() - - ui.query('body').style('background-color: #630000') - ui.colors(primary='#bf3a3a') - -# logscrnwin = customtkinter.CTk() -# logscrnwin.geometry("400x500") -# logscrnwin.title("zdkrimson : Minecraft Launcher - Login") - - ui.markdown('\n\n**Login**\n') - -# authtypeop = customtkinter.CTkOptionMenu(logframls, values=["Microsoft", "Cracked/Offline Mode"], command=selectedauth) -# authtypeop.pack(pady=10, padx=10) -# authtypeop.set("None Selected :|") - - authtypeop = ui.select({1: 'Microsoft', 2: 'Cracked/Offline Mode'}) - - userls = ui.input(label='Username', placeholder='Enter in a Username', - validation={'Username Longer than Minecraft Supports, May cause problems!': lambda value: len(value) < 16}) - - maills = ui.input(label='E-Mail', placeholder='Enter your E-Mail, it must own a legitmate copy of Minecraft') - - uuidls = ui.input(label='UUID (Optional)', placeholder='Player UUID') - - ui.button('Login', on_click=login) - - @ui.page('/settings') - def settings(): - def userchange(value): - print(value) - lastcrack=(value) - print(lastcrack) - config = { - "lastcrack": "{}".format(value), - "firsttime": "{}".format(firsttime), - "lastinstance": "{}".format(firsttime) - } - configjson = json.dumps(config, indent=2) - with open(".zdkrimson\\settings.json", "w") as outfile: - outfile.write(configjson) - - if os.path.exists(".zdkrimson\\crackedusers\\crackaccount.txt")==True: - cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "r") - rcadb = cadb.readlines() - print(rcadb) - - with open('.zdkrimson\\settings.json', 'r') as openfile: - configjson = json.load(openfile) - print(configjson['lastcrack']) - lastcrack=configjson['lastcrack'] - -# settingswin = customtkinter.CTk() -# settingswin.geometry("400x500") -# settingswin.title("zdkrimson : Minecraft Launcher - Settings") - - ui.markdown('\n\nSettings\n') - - ui.label('\nUsers\n') - - ui.select(options=rcadb, with_input=True, - on_change=lambda e: ui.notify("You Selected '{}'".format(e))).classes('w-40') - - def openinstances(): - def installinstances(): - def dlv(): - dlver=verent.get() - print(dlver) - print(lastcrack) - launchinfo.configure(text="Minecraft Version {}".format(dlver)) - if not lastcrack=="": - print("starting...") - lastcrackn=lastcrack.strip() - print("portablemc start -u {} {}".format(lastcrackn, dlver)) - os.mkdir(".zdkrimson\\instances\\{}".format(dlver)) - os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver)) -# if dlver=="1.6.1": -# os.mkdir(".zdkrimson\\instances\\resourcepacks") - os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks") - mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True) - - else: - print("oh no microsoft no work yet :(") - lastcrackn=lastcrack.strip() - print("portablemc start -u {} {}".format(lastcrackn, dlver)) - os.mkdir(".zdkrimson\\instances\\{}".format(dlver)) - os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver)) - os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks") - mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True) - - installwin = customtkinter.CTk() - installwin.geometry("300x200") - installwin.title("zdkrimson : Minecraft Launcher - Install Minecraft") - - maininsl = customtkinter.CTkFrame(master=installwin, fg_color="#3D0A11") - maininsl.pack(pady=0, padx=0, fill="both", expand=True) - - homeinsl = customtkinter.CTkFrame(master=maininsl, fg_color="#630000") - homeinsl.pack(pady=20, padx=20, fill="both", expand=True) - - innaent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Instance Name") - innaent.pack(pady=10, padx=10) - - verent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Minecraft Version") - verent.pack(pady=10, padx=10) - - setbtn = customtkinter.CTkButton(master=homeinsl, text="Download & Play", command=dlv) - setbtn.pack(padx=20, pady=10) - - installwin.mainloop() - - def lmc(): - lmcver=verins.get() - lastcrackn=lastcrack.strip() - print(lmcver) - print(lastcrack) - print(lastcrackn) - if lmcver=="Select Version": - statusins.configure(text="Pick a Minecraft Version!!!") - else: - print("starting...") -# os.rmdir("{}\\.minecraft\\resourcepacks".format(appdata)) -# os.rmdir("{}\\.minecraft\\saves".format(appdata)) -# shutil.copytree(".zdkrimson\\instances\\{}\\resourcepacks".format(lmcver), "{}\\.minecraft".format(appdata)) -# shutil.copytree(".zdkrimson\\instances\\{}\\saves".format(lmcver), "{}\\.minecraft".format(appdata)) - print("portablemc start -u {} {}".format(lastcrackn, lmcver)) - mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, lmcver), shell=True) - - mcversions=os.listdir("{}\\.minecraft\\versions".format(appdata)) - - instancewin = customtkinter.CTk() - instancewin.geometry("400x500") - instancewin.title("zdkrimson : Minecraft Launcher - Instances") - - mainins = customtkinter.CTkFrame(master=instancewin, fg_color="#3D0A11") - mainins.pack(pady=0, padx=0, fill="both", expand=True) - - homeins = customtkinter.CTkFrame(master=mainins, fg_color="#630000") - homeins.pack(pady=40, padx=40, fill="both", expand=True) - - if os.path.exists("{}\\.minecraft".format(appdata))==False or mcversions==[]: - statusins = customtkinter.CTkLabel(master=homeins, text="No Instances Found, Work in Progress") - statusins.pack(pady=30, padx=0) - - getmc = customtkinter.CTkButton(master=homeins, text="Get Minecraft", command=installinstances) - getmc.pack(padx=20, pady=10) - - else: - print(mcversions) - verins = customtkinter.CTkOptionMenu(homeins, values=mcversions) - verins.pack(pady=10, padx=10) - verins.set("Select Version") - - launchbtn = customtkinter.CTkButton(master=homeins, text="Launch", command=lmc) - launchbtn.pack(padx=20, pady=10) - - getmc = customtkinter.CTkButton(master=mainins, text="Get Minecraft", command=installinstances) - getmc.pack(padx=20, pady=10) - - instancewin.mainloop() - - # REQUEST FOR MINECRAFT VERSIONS - #verget = requests.get("https://launchermeta.mojang.com/mc/game/version_manifest.json") - #print(verget) - #print(verget.content) -#- vergetstr=verget.content - -# ui.avatar(whitelogoshaded) - -# ui.avatar(whitetextshaded) - -# ui.avatar(amlshaded) - -# ui.query('body').style('background-image: url(file://{}/assets/bg/blur/crim1.png)'.format(CDDIR)) - - ui.image(whitelogoshaded) - - ui.button('Accounts', on_click=loginscrn) - - ui.link('temp account btn', '/login') - - ui.button('Settings', on_click=settings) - - ui.link('temp settings btn', '/settings') - - ui.button('Instances', on_click=openinstances) - - ui.label('Launcher Version: {}'.format(__version__)) - - ui.run(native=True, reload=False, title="zdkrimson : Minecraft Launcher", window_size=(700, 600), dark=True) - -splash.after(3000, main_win) - -splash.mainloop() +import subprocess +import customtkinter +from nicegui import ui +import os +from threading import Timer +from os import path +import pyngrok +import json +import requests +import shutil +import schedule +import errno +from subprocess import Popen +from PIL import Image +from tkinter import messagebox + +# Themes +customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light" +customtkinter.set_default_color_theme("krimson.json") # Themes: "blue" (standard), "green", "dark-blue" +ui.query('body').style('background-color: #630000') +ui.colors(primary='#bf3a3a') + +# check if portablemc module is installed, if not install it +try: + import portablemc +except ModuleNotFoundError as e: + def dlmodule(): + def checkmodule(): + try: + import portablemc + print("works!") + messagebox.showinfo("Module Installed", "The 'portablemc' Module has successfully been installed!!!\nzdkrimson will now launch.\nIf Minecraft doesn't launch try 'pip freeze' in your terminal and look for 'portablemc' in the list of installed Python modules, if it isn't then try 'pip install portablemc' in your terminal.\nzdkrimson will now close so you may reopen it if you'd like.") + nomod.destroy() + except ModuleNotFoundError as e: + print("Retrying in 3 seconds...") + Timer(3, checkmodule).start() + subprocess.Popen("pip install portablemc") + nmtitle.configure(text="\n\nInstalling...") + nmmsg.configure(text="\n\n'portablemc' Module is being installed...\nPlease Wait") + nmbtn.pack_forget() + checkmodule() + + print("Missing Module! 'portablemc' Module is missing!") + + nomod = customtkinter.CTk() + nomod.geometry("700x600") + nomod.title("zdkrimson : Minecraft Launcher - Required Module not Installed!") + nomod.iconbitmap("zdicon.ico") + mainframen = customtkinter.CTkFrame(master=nomod, fg_color="#3D0A11") + mainframen.pack(pady=0, padx=0, fill="both", expand=True) + + nmtitle = customtkinter.CTkLabel(master=mainframen, text="\n\nOh No!") + nmtitle.pack(pady=0, padx=0) + + nmframe = customtkinter.CTkFrame(master=mainframen, fg_color="#630000") + nmframe.pack(pady=20, padx=40, fill="both", expand=True) + + nmmsg = customtkinter.CTkLabel(master=nmframe, text="\n\nThe 'portablemc' Module has not been found\non your system!") + nmmsg.pack(pady=0, padx=0) + + nmbtn = customtkinter.CTkButton(master=nmframe, text="Install Module (Requires Python Installed!)", command=dlmodule) + nmbtn.pack(padx=20, pady=10) + + nomod.mainloop() + + + + + +print(r""" + _ _ _ + | || | (_) + ____ __| || | __ _ __ _ _ __ ___ ___ ___ _ __ +|_ / / _` || |/ /| '__|| || '_ ` _ \ / __| / _ \ | '_ \ + / / | (_| || < | | | || | | | | |\__ \| (_) || | | | +/___| \__,_||_|\_\|_| |_||_| |_| |_||___/ \___/ |_| |_| + Written by ItsIceCreeperPE Dev & Artsign + + """) + +appdata=path.expandvars(r'%APPDATA%') +print("{}\\.minecraft".format(appdata)) +authtype=0 +CDDIR=os.getcwd() +global lastcrack +global firstime +global __version__ +lastcrack="" +firstime=0 +__version__="alpha5" +instances=[] +print(CDDIR) +global zdusername +global zdemail +global zduuid +zdusername="" +zdemail="" +zduuid="" + +# File/Folder Checking +if os.path.exists(".zdkrimson")==False: + print(".zdkrimson folder doesn't exist, created one just now.") + os.mkdir(".zdkrimson") + +if os.path.exists(".zdkrimson\\crackedusers")==False: + print("crackedusers folder doesn't exist, created one just now.") + os.mkdir("{}\\.zdkrimson\\crackedusers".format(CDDIR)) + +if os.path.exists(".zdkrimson\\settings.json")==False: + print("settings file(settings.json) doesn't exist, created one just now.") + config = { + "lastcrack": "", + "firsttime": 1, + "lastinstance": "" + } + configjson = json.dumps(config, indent=2) + with open(".zdkrimson\\settings.json", "w") as outfile: + outfile.write(configjson) + lastcrack="" + firstime=1 + lastinstance="" + +if os.path.exists(".zdkrimson\\instances")==False: + print("instances folder doesn't exist, created one just now.") + os.mkdir(".zdkrimson\\instances") + +# loading json files +with open('.zdkrimson\\settings.json', 'r') as openfile: + configjson = json.load(openfile) + try: + print(configjson['lastcrack']) + print(configjson['firsttime']) + print(configjson['lastinstance']) + lastcrack=configjson['lastcrack'] + firsttime=configjson['firsttime'] + lastinstance=configjson['lastinstance'] + print("imported settings json") + print(lastcrack) + except KeyError: + print("Settings file isn't up-to-date") + config = { + "lastcrack": "", + "firsttime": 1, + "lastinstance": "" + } + configjson = json.dumps(config, indent=2) + with open(".zdkrimson\\settings.json", "w") as outfile: + outfile.write(configjson) + lastcrack="" + firstime=1 + lastinstance="" + +splash = customtkinter.CTk() +splash.title("zdkrimson : Minecraft Launcher - Starting") +splash.geometry("350x262") +splash.overrideredirect(True) +splash.eval('tk::PlaceWindow . center') + +splashScreen = customtkinter.CTkImage(dark_image=Image.open("assets/splashScreen.png"), size=(350, 262)) + +splashimg = customtkinter.CTkLabel(master=splash, text="", image=splashScreen, justify=customtkinter.LEFT) +splashimg.pack(side=customtkinter.LEFT, pady=0, padx=0) + +@ui.page('/home') +def main_win(): + splash.destroy() + + # image loading + crim1 = "assets/bg/blur/crim1.png" + whitelogoshaded = "assets/logo/image/shaded/white.png" + whitetextshaded = "assets/logo/full/white.png" + amlshaded = "assets/logo/sub/shaded/white.png" + + def move_app(e): + app.geometry(f'+{e.x_root}+{e.y_root}') + + def quit(): + app.quit() + + def download(): + minecraft_directory = str(path.get()) + print(str(path.get())) + minecraft_launcher_lib.install.install_minecraft_version(version.get(), minecraft_directory) + + def play(): + print("text") + + @ui.page('/login') + def loginscrn(): + def selectedauth(value): + if value=="Microsoft": + usermaills.configure(placeholder_text="E-Mail") + authtype="Microsoft" + print(authtype) + uuidls.pack_forget() + else: + usermaills.configure(placeholder_text="Username") + uuidls.pack_forget() + + if value=="Cracked/Offline Mode": + authtype="Cracked/Offline Mode" + print(authtype) + logls.pack_forget() + uuidls.pack(pady=10, padx=10) + logls.pack(padx=20, pady=0) + + def login(): + zdusername=userls + zdemail=maills + zduuid=uuidls + zdoption=authtypeop + print(zdusername) + print(zdemail) + print(zduuid) + print(zdoption) +# print(authtype) +# print(authtypeop) + if zdoption=="Microsoft": + with ui.dialog() as dialog, ui.card(): + ui.markdown('**Notice!**') + ui.label("The Application will stop responding until the authentication as been completed.\nThe Authentication page should open in your default browser.\nClick 'OK' to continue the authentication process.\nClick 'Escape' on your keyboard to cancel.") + ui.button('OK', on_click=dialog.close) + dialog.open() + loginprocms=subprocess.call("{}\\portablemc login -m {}".format(CDDIR, zdemail)) + print(loginprocms) + if loginprocms==14: + ui.notify("Your Microsoft account doesn't have a legitmate copy of Minecraft.", closeBtn="OK") + else: + ui.notify("You own Minecraft, you are logged in!", closeBtn="OK") + user = { + "name": "{}".format(zdemail), + "uuid": "microsoft" + } + jsonfilezd = json.dumps(user, indent=2) + with open(".zdkrimson\\crackedusers\\{}.json".format(zdemail), "w") as outfile: + outfile.write(jsonfilezd) + cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a") + print(cadb) + cadb.write("{}\n".format(zdemail)) + cadb.close() + elif zdoption=="Cracked/Offline Mode": +# loginprocco=subprocess.call("{}\\portablemc -u {} -u {}".format(CDDIR, zdemail, zduuid)) + lastcrack=zdusername + user = { + "name": "{}".format(zdusername), + "uuid": "{}".format(zduuid) + } + jsonfilezd = json.dumps(user, indent=2) + with open(".zdkrimson\\crackedusers\\{}.json".format(zdusername), "w") as outfile: + outfile.write(jsonfilezd) + ui.notify("You are logged in as {} as a Cracked/Offline Mode Player.".format(zdusername), closeBtn="OK") + cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a") + print(cadb) + cadb.write("{}\n".format(zdusername)) + cadb.close() + + ui.query('body').style('background-color: #630000') + ui.colors(primary='#bf3a3a') + +# logscrnwin = customtkinter.CTk() +# logscrnwin.geometry("400x500") +# logscrnwin.title("zdkrimson : Minecraft Launcher - Login") + + ui.markdown('\n\n**Login**\n') + +# authtypeop = customtkinter.CTkOptionMenu(logframls, values=["Microsoft", "Cracked/Offline Mode"], command=selectedauth) +# authtypeop.pack(pady=10, padx=10) +# authtypeop.set("None Selected :|") + + authtypeop = ui.select({1: 'Microsoft', 2: 'Cracked/Offline Mode'}) + + userls = ui.input(label='Username', placeholder='Enter in a Username', + validation={'Username Longer than Minecraft Supports, May cause problems!': lambda value: len(value) < 16}) + + maills = ui.input(label='E-Mail', placeholder='Enter your E-Mail, it must own a legitmate copy of Minecraft') + + uuidls = ui.input(label='UUID (Optional)', placeholder='Player UUID') + + ui.button('Login', on_click=login) + + @ui.page('/settings') + def settings(): + def userchange(value): + print(value) + lastcrack=(value) + print(lastcrack) + config = { + "lastcrack": "{}".format(value), + "firsttime": "{}".format(firsttime), + "lastinstance": "{}".format(firsttime) + } + configjson = json.dumps(config, indent=2) + with open(".zdkrimson\\settings.json", "w") as outfile: + outfile.write(configjson) + + if os.path.exists(".zdkrimson\\crackedusers\\crackaccount.txt")==True: + cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "r") + rcadb = cadb.readlines() + print(rcadb) + + with open('.zdkrimson\\settings.json', 'r') as openfile: + configjson = json.load(openfile) + print(configjson['lastcrack']) + lastcrack=configjson['lastcrack'] + +# settingswin = customtkinter.CTk() +# settingswin.geometry("400x500") +# settingswin.title("zdkrimson : Minecraft Launcher - Settings") + + ui.markdown('\n\nSettings\n') + + ui.label('\nUsers\n') + + ui.select(options=rcadb, with_input=True, + on_change=lambda e: ui.notify("You Selected '{}'".format(e))).classes('w-40') + + def openinstances(): + def installinstances(): + def dlv(): + dlver=verent.get() + print(dlver) + print(lastcrack) + launchinfo.configure(text="Minecraft Version {}".format(dlver)) + if not lastcrack=="": + print("starting...") + lastcrackn=lastcrack.strip() + print("portablemc start -u {} {}".format(lastcrackn, dlver)) + os.mkdir(".zdkrimson\\instances\\{}".format(dlver)) + os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver)) +# if dlver=="1.6.1": +# os.mkdir(".zdkrimson\\instances\\resourcepacks") + os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks") + mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True) + + else: + print("oh no microsoft no work yet :(") + lastcrackn=lastcrack.strip() + print("portablemc start -u {} {}".format(lastcrackn, dlver)) + os.mkdir(".zdkrimson\\instances\\{}".format(dlver)) + os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver)) + os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks") + mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True) + + installwin = customtkinter.CTk() + installwin.geometry("300x200") + installwin.title("zdkrimson : Minecraft Launcher - Install Minecraft") + + maininsl = customtkinter.CTkFrame(master=installwin, fg_color="#3D0A11") + maininsl.pack(pady=0, padx=0, fill="both", expand=True) + + homeinsl = customtkinter.CTkFrame(master=maininsl, fg_color="#630000") + homeinsl.pack(pady=20, padx=20, fill="both", expand=True) + + innaent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Instance Name") + innaent.pack(pady=10, padx=10) + + verent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Minecraft Version") + verent.pack(pady=10, padx=10) + + setbtn = customtkinter.CTkButton(master=homeinsl, text="Download & Play", command=dlv) + setbtn.pack(padx=20, pady=10) + + installwin.mainloop() + + def lmc(): + lmcver=verins.get() + lastcrackn=lastcrack.strip() + print(lmcver) + print(lastcrack) + print(lastcrackn) + if lmcver=="Select Version": + statusins.configure(text="Pick a Minecraft Version!!!") + else: + print("starting...") +# os.rmdir("{}\\.minecraft\\resourcepacks".format(appdata)) +# os.rmdir("{}\\.minecraft\\saves".format(appdata)) +# shutil.copytree(".zdkrimson\\instances\\{}\\resourcepacks".format(lmcver), "{}\\.minecraft".format(appdata)) +# shutil.copytree(".zdkrimson\\instances\\{}\\saves".format(lmcver), "{}\\.minecraft".format(appdata)) + print("portablemc start -u {} {}".format(lastcrackn, lmcver)) + mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, lmcver), shell=True) + + mcversions=os.listdir("{}\\.minecraft\\versions".format(appdata)) + + instancewin = customtkinter.CTk() + instancewin.geometry("400x500") + instancewin.title("zdkrimson : Minecraft Launcher - Instances") + + mainins = customtkinter.CTkFrame(master=instancewin, fg_color="#3D0A11") + mainins.pack(pady=0, padx=0, fill="both", expand=True) + + homeins = customtkinter.CTkFrame(master=mainins, fg_color="#630000") + homeins.pack(pady=40, padx=40, fill="both", expand=True) + + if os.path.exists("{}\\.minecraft".format(appdata))==False or mcversions==[]: + statusins = customtkinter.CTkLabel(master=homeins, text="No Instances Found, Work in Progress") + statusins.pack(pady=30, padx=0) + + getmc = customtkinter.CTkButton(master=homeins, text="Get Minecraft", command=installinstances) + getmc.pack(padx=20, pady=10) + + else: + print(mcversions) + verins = customtkinter.CTkOptionMenu(homeins, values=mcversions) + verins.pack(pady=10, padx=10) + verins.set("Select Version") + + launchbtn = customtkinter.CTkButton(master=homeins, text="Launch", command=lmc) + launchbtn.pack(padx=20, pady=10) + + getmc = customtkinter.CTkButton(master=mainins, text="Get Minecraft", command=installinstances) + getmc.pack(padx=20, pady=10) + + instancewin.mainloop() + + # REQUEST FOR MINECRAFT VERSIONS + #verget = requests.get("https://launchermeta.mojang.com/mc/game/version_manifest.json") + #print(verget) + #print(verget.content) +#- vergetstr=verget.content + +# ui.avatar(whitelogoshaded) + +# ui.avatar(whitetextshaded) + +# ui.avatar(amlshaded) + +# ui.query('body').style('background-image: url(file://{}/assets/bg/blur/crim1.png)'.format(CDDIR)) + + ui.image(whitelogoshaded) + + ui.button('Accounts', on_click=loginscrn) + + ui.link('temp account btn', '/login') + + ui.button('Settings', on_click=settings) + + ui.link('temp settings btn', '/settings') + + ui.button('Instances', on_click=openinstances) + + ui.label('Launcher Version: {}'.format(__version__)) + + ui.run(native=True, reload=False, title="zdkrimson : Minecraft Launcher", window_size=(700, 600), dark=True) + +splash.after(3000, main_win) + +splash.mainloop() diff --git a/settings.css b/settings.css index adca553..6e7d11c 100644 --- a/settings.css +++ b/settings.css @@ -1,5 +1,5 @@ body { - background-color: darkred; + /*background-color: darkred;*/ overflow-x: hidden; overflow-y: auto; padding-top: 40px; @@ -28,16 +28,16 @@ body::-webkit-scrollbar-button { @font-face { font-family: 'Inter'; - src: url('../../assets/fonts/inter/Inter-Regular.ttf'); + src: url('assets/fonts/inter/Inter-Regular.ttf'); } @font-face { font-family: 'InterThin'; - src: url('../../assets/fonts/inter/Inter-Thin.ttf'); + src: url('assets/fonts/inter/Inter-Thin.ttf'); } p, h1, h2, h3, h4, h5, h6, div { - font-family: inter; + font-family: 'Inter'; color: white; } @@ -47,9 +47,14 @@ p { .sidebar { display: flex; + position: fixed; + top: 40px ; flex-direction: column; margin: 0; margin-top: -7px; + height: 100%; + overflow-y: hidden; + z-index: 5; } .sidebar-button { @@ -87,7 +92,7 @@ p { .sidebar-button:active { scale: 0.99; - background-color: #09060d; + background-color: #00000040; box-shadow: 0px 0px 20px #00000030; } @@ -98,7 +103,8 @@ p { left: 180px; margin-top: 50px; margin-left: -3px; - top: 0; + position: fixed; + top: 0px; } @@ -114,6 +120,7 @@ hr { position: flex; flex-direction: column; margin: 0; + overflow-y: auto; } .content { @@ -121,8 +128,13 @@ hr { display: flex; flex-direction: column; top: 0; - left: 200px; + left: 0; + padding-left: 200px; padding-top: 35px; + opacity: 0; + overflow-y: auto; + width: 100%; + height: 100%; } .section { @@ -132,8 +144,9 @@ hr { display: inline-flex; flex-direction: column; align-items: left; - justify-content: center; + /*justify-content: center;*/ box-shadow: 0px 0px 20px #00000070; + width: 300px; } .label { @@ -141,7 +154,7 @@ hr { color: #ffffff70; } -.systemsection { +.zdksection { border: 2px solid #ffffff10; border-radius: 10px; padding: 12px; @@ -190,4 +203,85 @@ iframe { align-items: center; gap: 10px; height: 40px; -} \ No newline at end of file + z-index: 10; +} + +.windowtextbox { + align-items: right; + width: 100px; +} + +input { + background-color: #00000070; + border: 0; + border-radius: 5px; + padding: 2px; + color: white; + font-family: 'Inter'; + outline: 0px solid #00000050; + transition-duration: 0.2s; +} + +input:focus { + outline: 2px solid #00000050; +} + +/* Hide the default number input arrows */ +input[type=number] { + -webkit-appearance: none; /* WebKit/Blink browsers */ + -moz-appearance: textfield; /* Firefox */ + appearance: textfield; /* Standard */ +} + +button { + background-color: #00000070; + font-family: 'Inter'; + color: white; + border: 0; + padding: 5px; + border-radius: 10px; + transition-duration: 0.2s +} + +button:hover { + background-color: #00000060; + box-shadow: 0px 0px 7px #00000020; + scale: 1.05; +} + +button:active { + background-color: #00000080; + scale: 0.97; +} + +@keyframes fadein { + from { + opacity: 0; + pointer-events: none; + } + to { + opacity: 1; + pointer-events: all; + } +} + +.fadein { + animation: fadein 0.2s ease-in-out forwards; +} + +@keyframes fadeout { + from { + opacity: 1; + pointer-events: all; + } + to { + opacity: 0; + pointer-events: none; + } +} + +.fadeout { + animation: fadeout 0.2s ease-in-out forwards; +} + +/* i've spent an unreasonable amount of time tryna figure out why the settings menu cant scroll \ No newline at end of file diff --git a/settings.html b/settings.html index d6c19e2..8e5adaa 100644 --- a/settings.html +++ b/settings.html @@ -3,51 +3,52 @@ zdkrimson +
-

Settings

-
+

Launcher

-
- +
+
zdkrimson
-
ver
+
Beta 1

Your Device

@@ -58,13 +59,111 @@

Your Device

Host:

Resolution:

-

AzuOS Information

+

Minecraft Information

-

System Storage:

-

OS Version:

-

AZML Version:

+

Default Java:

+

Instances Directory:

+
+

Minecraft

+

Window Size

+
+
+ +
+
+
+ + +
+
+ + +
+
+

Miscellaneous

+
+
+ +
+
+
+ +
+
+
+ +
+
+
+

Minecraft Information

+
+

Default Java:

+

Instances Directory:

+
+
+
+

Java

+

Memory

+
+
+ + + +
+
+ + + +
+
+

Java Runtime

+
+
+ + +
+
+ + +
+
+
+
+

Accounts

+
+ + + +
+
+
+

i need to figure this out

+
+
+
+

Themes

+

Coming soon... (Probably)

+
+
+

About Us

+

zdkrimson is a launcher built to make the Minecraft Experience just a little better.

+

Packed with tons of 'Quality of Life' features enhancing your experience with the game.

+
+

Links

+
+

Github:

+

YouTube:

+
+

Developers

+
+

Creator: MTSyntho

+

Maintainer: HGT-123

+
+



+

Made with <3

+
diff --git a/settings.js b/settings.js new file mode 100644 index 0000000..5855a8d --- /dev/null +++ b/settings.js @@ -0,0 +1,117 @@ +function closeSettings() { + // Send message from iframe to parent window + window.parent.postMessage('hideSettings', '*'); +} + +// Check if the webpage is not loaded inside an iframe + + + +//This code snippet sets the background to dark red if ran outside an iframe, this makes writing the settings page easier without it being embedded? +// Im writing the settings page in it's own tab, not in the iframe cuz i need to refresh the page then open up the settings menu every new change +// Wait for DOM content to be fully loaded +document.addEventListener('DOMContentLoaded', function() { + var launcher = document.getElementById("launcher"); + launcher.classList.add('fadein'); + if (window.self === window.top) { + // Not inside an iframe + document.body.style.backgroundColor = 'darkred'; + } +}); + + +function launcher() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.add("fadein"); + mc.classList.remove("fadein"); + java.classList.remove("fadein"); + accounts.classList.remove("fadein"); + themes.classList.remove("fadein"); + about.classList.remove("fadein"); +} + +function minecraft() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.remove("fadein"); + mc.classList.add("fadein"); + java.classList.remove("fadein"); + accounts.classList.remove("fadein"); + themes.classList.remove("fadein"); + about.classList.remove("fadein"); +} + +function java() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.remove("fadein"); + mc.classList.remove("fadein"); + java.classList.add("fadein"); + accounts.classList.remove("fadein"); + themes.classList.remove("fadein"); + about.classList.remove("fadein"); +} + +function accounts() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.remove("fadein"); + mc.classList.remove("fadein"); + java.classList.remove("fadein"); + accounts.classList.add("fadein"); + themes.classList.remove("fadein"); + about.classList.remove("fadein"); +} + +function themes() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.remove("fadein"); + mc.classList.remove("fadein"); + java.classList.remove("fadein"); + accounts.classList.remove("fadein"); + themes.classList.add("fadein"); + about.classList.remove("fadein"); +} + +function about() { + var launcher = document.getElementById("launcher"); + var mc = document.getElementById("minecraft"); + var java = document.getElementById("java"); + var accounts = document.getElementById("accounts"); + var themes = document.getElementById("themes"); + var about = document.getElementById("about"); + + launcher.classList.remove("fadein"); + mc.classList.remove("fadein"); + java.classList.remove("fadein"); + accounts.classList.remove("fadein"); + themes.classList.remove("fadein"); + about.classList.add("fadein"); +}