Skip to content

Commit

Permalink
add first version
Browse files Browse the repository at this point in the history
  • Loading branch information
WindClan committed Mar 3, 2024
0 parents commit eece4f8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bootstrap.jar
version.txt
dist
33 changes: 33 additions & 0 deletions MinecraftLauncher.pyw
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os.path
import subprocess
import requests
import json
from subprocess import STDOUT,PIPE

if not os.path.isfile("version.txt"):
a = open("version.txt", "w")
a.write(":3")
a.close()
jre = "javaw"
webUrl = "https://api.github.com/repos/olauncher/olauncher/releases/latest"
version = requests.get(webUrl)
a = open("version.txt", "r")
current = a.read()
a.close()

if version.status_code == 200:
content = json.loads(version.text)
release = content["assets"][0]
if current != content["name"]:
a = open("version.txt", "w")
a.write(content["name"])
a.close()
current = content["name"]
jar = requests.get(release["browser_download_url"], stream=True)
if jar.status_code == 200:
with open("bootstrap.jar", 'wb') as a:
for chunk in jar.iter_content(chunk_size=128):
a.write(chunk)
else:
raise Exception("no internet?")
subprocess.Popen([jre,"-Dnet.minecraft.launcher.WindowTitle=Minecraft Launcher "+current[1:len(current)],"-jar","bootstrap.jar"], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
Binary file added favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import py2exe

py2exe.freeze(
windows=[{"script":'MinecraftLauncher.pyw',"icon_resources":[(1,"favicon.ico")]}],
#zipfile='library.zip',
zipfile=None,
)

0 comments on commit eece4f8

Please sign in to comment.