Skip to content

Commit

Permalink
add dump mappings button
Browse files Browse the repository at this point in the history
  • Loading branch information
beebls committed Jul 28, 2024
1 parent 9d3c829 commit 90d3982
Show file tree
Hide file tree
Showing 6 changed files with 1,374 additions and 1,073 deletions.
15 changes: 15 additions & 0 deletions css_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def create_cef_flag() -> Result:
def store_path() -> str:
return os.path.join(get_theme_path(), "STORE")

def get_mappings_folder_path() -> str:
return os.path.join(get_theme_path(), "MAPPINGS")

def store_reads() -> dict:
path = store_path()
items = {}
Expand Down Expand Up @@ -157,7 +160,19 @@ def store_write(key : str, val : str):
items[key] = val.replace('\n', '')
with open(path, 'w') as fp:
fp.write("\n".join([f"{x}:{items[x]}" for x in items]))

def save_mappings(val: str, version: str):
is_beta = is_steam_beta_active()
branch_str = "beta" if is_beta else "stable"
path = get_mappings_folder_path()

if not os.exists(path):
create_dir(path)

file_location = os.path.join(path, f"{version}.{branch_str}.json")
with open(file_location, 'w') as fp:
fp.write(val)

def store_or_file_config(key : str) -> bool:
if os.path.exists(os.path.join(get_theme_path(), key.upper())):
return True
Expand Down
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

sys.path.append(os.path.dirname(__file__))

from css_utils import Log, create_steam_symlink, Result, get_theme_path, store_read as util_store_read, store_write as util_store_write, store_or_file_config, is_steam_beta_active
from css_utils import Log, create_steam_symlink, Result, get_theme_path, save_mappings as util_save_mappings, store_read as util_store_read, store_write as util_store_write, store_or_file_config, is_steam_beta_active
from css_inject import ALL_INJECTS, initialize_class_mappings
from css_theme import CSS_LOADER_VER
from css_remoteinstall import install
Expand Down Expand Up @@ -179,6 +179,10 @@ async def store_read(self, key : str) -> str:
async def store_write(self, key : str, val : str) -> dict:
util_store_write(key, val)
return Result(True).to_dict()

async def save_mappings(self, val: str, version: str) -> dict:
util_save_mappings(val, version)
return Result(True).to_dict()

async def exit(self):
try:
Expand Down
Loading

0 comments on commit 90d3982

Please sign in to comment.