-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
88 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"appVer": "2.67.0", "verCode": "b7c29a7ea5620ce9e9b56e198761f8adabda3b019c32b714a3696ea87464c255"} | ||
{"appVer": "2.67.0", "verCode": "b7c29a7ea5620ce9e9b56e198761f8adabda3b019c32b714a3696ea87464c255"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import os; | ||
|
||
# https://fgo.square.ovh/apk/com.aniplex.fategrandorder.en.apk | ||
url_apk = "https://fgo.square.ovh/apk/com.aniplex.fategrandorder.en.apk" | ||
url_apk = "https://fgo.bigcereal.com/apk/com.aniplex.fategrandorder.en.xapk" | ||
|
||
# https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder | ||
url_version = "https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder.en" | ||
|
||
apk_name = url_apk.split("/")[-1] | ||
|
||
# Temp folder | ||
temp_folder = os.path.join(os.getcwd(), "temp") |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import requests; | ||
import config; | ||
import os; | ||
import sys | ||
import os | ||
import httpx | ||
import config | ||
from libs.python.logger import logger | ||
|
||
def download_latest(): | ||
print('[App] Creating folder...', file=sys.stdout) | ||
os.mkdir(config.temp_folder); | ||
os.mkdir(os.path.join(config.temp_folder, "decrypt")); | ||
logger.info('Creating folder...') | ||
|
||
print('[App] Downloading latest apk...!', file=sys.stdout) | ||
os.mkdir(config.temp_folder) | ||
os.mkdir(os.path.join(config.temp_folder, "decrypt")) | ||
|
||
# Create path to save file | ||
apk = os.path.join(config.temp_folder, "fate.apk") | ||
logger.info('Downloading latest apk...!') | ||
|
||
with httpx.stream("GET", config.url_apk, follow_redirects=True) as response: | ||
response.raise_for_status() | ||
|
||
# Download and Save the file | ||
response = requests.get(config.url_apk) | ||
open(apk, "wb").write(response.content) | ||
with open(os.path.join(config.temp_folder, config.apk_name), "wb") as file: | ||
for chunk in response.iter_bytes(): | ||
file.write(chunk) | ||
|
||
print('[App] Apk downloaded!', file=sys.stdout) | ||
logger.info('Apk downloaded!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import logging | ||
|
||
logging.basicConfig( | ||
filemode="w", | ||
filename="run.log", | ||
format="%(levelname)s | %(module)s | L%(lineno)d | %(asctime)s: %(message)s", | ||
datefmt="%Y-%m-%dT%H:%M:%S%z", | ||
level=logging.INFO | ||
) | ||
|
||
logger = logging.getLogger("VerCode (Extractor)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import json | ||
import os | ||
import requests | ||
import config | ||
import sys | ||
import httpx | ||
|
||
from libs.python.logger import logger | ||
|
||
pathRoot = os.getcwd() | ||
pathVerCode = os.path.join(pathRoot, "VerCode.json") | ||
|
||
def get_version(): | ||
res = requests.get(config.url_version); | ||
return res.content.decode('utf8') | ||
return httpx.get(config.url_version).text | ||
|
||
def is_necesary_update(current, latest): | ||
return current != latest | ||
|
||
def check_update(): | ||
if os.path.exists(pathVerCode): | ||
with open(pathVerCode) as fVerCode: | ||
dataVerCode = json.load(fVerCode) | ||
versionVerCode = dataVerCode["appVer"] | ||
versionAtlas = get_version() | ||
|
||
if (versionVerCode != versionAtlas): | ||
print("Need update!", file=sys.stdout) | ||
return True | ||
else: | ||
print('Is not necesary update!', file=sys.stdout) | ||
return False | ||
logger.info(f"Current installed version: {versionVerCode}, up-to-date with the latest available version: {versionAtlas}.") | ||
return is_necesary_update(versionVerCode, versionAtlas) | ||
else: | ||
print('First Time!', file=sys.stdout) | ||
|
||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
requests==2.27.1 | ||
httpx==0.27.0 |