Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.0.0 #98

Merged
merged 73 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e951b41
Fix #93, Fix #94
suchmememanyskill Aug 2, 2023
33b1b4b
Update desktop rule to be more precise
suchmememanyskill Aug 3, 2023
172d0f4
fix: Creating a profile with none selected now switches to it properly
beebls Aug 5, 2023
309db91
Implement display_name in backend
suchmememanyskill Aug 10, 2023
0dd42fd
fix: No longer attempt to enable "None"
beebls Aug 11, 2023
9b19316
Fix #95
suchmememanyskill Aug 12, 2023
2795d10
Fix #96
suchmememanyskill Aug 12, 2023
b95ab07
Fix #92
suchmememanyskill Aug 12, 2023
e2b3990
Return failed to load themes on reset()
suchmememanyskill Aug 12, 2023
f233555
Make sure display name is not null
suchmememanyskill Aug 12, 2023
bb0227c
use `display_name` for user-facing display of theme names
beebls Aug 14, 2023
3ebc68f
refactor enabling/disabling of themes to a function
beebls Aug 14, 2023
8f18620
feat: Add Nav Patch (5/6)
beebls Aug 16, 2023
ebb84d4
finish up Nav Patch UI
beebls Aug 16, 2023
6e0358d
Further refinement of Nav Patch UI
suchmememanyskill Aug 16, 2023
765a5cc
Change case of displayName for API
beebls Aug 17, 2023
deccfc1
update API types
beebls Aug 17, 2023
a3d21fa
Change "CSSLoader" to "CSS Loader"
beebls Aug 18, 2023
bb102f1
fix: UI Fixes for Aug. 18th Steam Beta
beebls Aug 19, 2023
5cdf384
WIP: Theme Error displays
beebls Aug 22, 2023
6f12f5f
Add get_last_load_errors
suchmememanyskill Aug 22, 2023
3d39441
big big feat: Add Settings Page
beebls Aug 23, 2023
701af04
WIP: remake ExpandedView
beebls Aug 24, 2023
c74af11
Redo expanded view change
beebls Aug 24, 2023
358d475
update useEffect
beebls Aug 24, 2023
22ac77a
Creating a preset now creates a presetname.profile folder
suchmememanyskill Aug 25, 2023
7ed5a6a
Fixing things that were broken on deck but worked on desktop
beebls Aug 27, 2023
1531171
init
beebls Aug 27, 2023
0db3a1f
rewrite of store to mimic steam store
beebls Aug 27, 2023
dff9471
fix some text overflow
beebls Aug 27, 2023
602a33d
add targets
beebls Aug 28, 2023
50e3c3e
sync pnpm
beebls Aug 28, 2023
67a9c4d
Fix hsla color parser
suchmememanyskill Aug 29, 2023
e63b7b9
Fix hsl code... again
suchmememanyskill Aug 29, 2023
f455283
Split main.py into css_loader.py
suchmememanyskill Aug 29, 2023
23133f1
feat(DECK-69) fix(DECK-63) fix(DECK-68) fix(DECK-67)
beebls Sep 1, 2023
75773e3
Merge remote-tracking branch 'origin/steam-store-clone' into dev
suchmememanyskill Sep 1, 2023
5b3ab65
Fix backend
suchmememanyskill Sep 2, 2023
0f7dccb
Fix the backend again
suchmememanyskill Sep 2, 2023
0ab4ac9
fix(DECK-55): OptionalDeps doesn't block other theme enabling actiosn
beebls Sep 2, 2023
10dc7d3
feat(DECK-71): Revamped fullscreen theme settings
beebls Sep 3, 2023
955480f
Fix bugs in profile creator
suchmememanyskill Sep 3, 2023
a41e376
Merge branch 'dev' of https://github.com/suchmememanyskill/SDH-CssLoa…
suchmememanyskill Sep 3, 2023
3ff9018
Save state of live css editing
suchmememanyskill Sep 3, 2023
e027223
fug
suchmememanyskill Sep 3, 2023
7ce59c1
fix(DECK-72,DECK-73) feat(DECK-66)
beebls Sep 4, 2023
697bc2f
remove some useless imports
beebls Sep 4, 2023
027d6cb
feat(DECK-54): Update All Themes button
beebls Sep 4, 2023
d06a4ef
fix(DECK-52) and add configure and reinstall buttons side by side
beebls Sep 6, 2023
0e09cc6
WIP: add donate page
beebls Sep 7, 2023
d719cf5
d
beebls Sep 7, 2023
048db91
finally working implementation of patreon display
beebls Sep 8, 2023
65f4220
Use 127.0.0.1 instead of localhost
suchmememanyskill Sep 8, 2023
eba916b
Change text of donate page
suchmememanyskill Sep 10, 2023
bdd8a34
I'm not abusing github for builds you are
suchmememanyskill Sep 10, 2023
aed4a5b
Trying some more styling/textual changes
suchmememanyskill Sep 10, 2023
651a7c0
One last time
suchmememanyskill Sep 10, 2023
0220588
One more
suchmememanyskill Sep 10, 2023
d3864bd
fix scrolling on supporter list
beebls Sep 10, 2023
6f148d9
fix skill issue
beebls Sep 11, 2023
e09dfcd
rewrite and restyle BrowserItemCard
beebls Sep 11, 2023
24230be
allow resizing of cards
beebls Sep 11, 2023
edc1c2a
add interactable target buttons
beebls Sep 12, 2023
f1b70e1
Fix typo
suchmememanyskill Sep 13, 2023
84227ae
Add AuthorViewModal
beebls Sep 14, 2023
98cb7dc
Merge branch 'dev' of https://github.com/suchmememanyskill/SDH-CssLoa…
beebls Sep 14, 2023
64c0684
fix loading error and resize image carousel
beebls Sep 14, 2023
84f1162
Sort by display name
suchmememanyskill Sep 15, 2023
5f33fa4
Fix #4
suchmememanyskill Sep 16, 2023
a0eb270
remove back button, focus download button on open
beebls Sep 17, 2023
7238fcd
version bump (2.0 🎉)
beebls Sep 17, 2023
a3db80b
When a request fails, don't keep reset locked
suchmememanyskill Sep 18, 2023
204e4f9
Sanity check tabs every 5s
suchmememanyskill Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 56 additions & 6 deletions css_browserhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ async def _init(self):
if res != None:
self.title = res["title"]
self.html_classes = res["classes"]
else:
Log(f"Failed to connect to tab with id {self.id}")
self.hook.connected_tabs.remove(self)
return

self.init_done = True
Log(f"Connected to tab: {self.title}")
Expand Down Expand Up @@ -214,14 +218,14 @@ def __init__(self):
self.ws_url = None
self.ws_response : List[asyncio.Queue] = []
self.connected_tabs : List[BrowserTabHook] = []
self.tab_names = {}

asyncio.create_task(self.on_new_tab())
asyncio.create_task(self.on_tab_update())
asyncio.create_task(self.on_tab_attach())
asyncio.create_task(self.on_tab_detach())
asyncio.create_task(self.health_check())
asyncio.create_task(self.css_health_check())
asyncio.create_task(self.sanity_check_tabs())

def get_id(self) -> int:
self.current_id += 1
Expand Down Expand Up @@ -265,7 +269,7 @@ async def send_command(self, method : str, params : dict, sessionId : str|None,
result = await queue.get()

if (start_time + 5) < time.time():
Result(False, f"Request for {method} took more than 5s. Assuming it failed")
Result(False, f"Request for {method} took more than 5s. Assuming it failed ({len(self.connected_tabs)})")
self.ws_response.remove(queue)
del queue
return None
Expand All @@ -278,6 +282,10 @@ async def send_command(self, method : str, params : dict, sessionId : str|None,
return None
raise RuntimeError("Websocket not opened")

async def _tab_exists(self, tab_id : str):
result = await self.send_command("Target.getTargets", {}, None)
return tab_id in [x["targetId"] for x in result["result"]["targetInfos"] if x["type"] == "page"]

async def on_new_tab(self):
queue = asyncio.Queue(maxsize=MAX_QUEUE_SIZE)
self.ws_response.append(queue)
Expand All @@ -289,6 +297,9 @@ async def on_new_tab(self):
if message["params"]["targetInfo"]["type"] != "page":
continue

if not await self._tab_exists(message["params"]["targetInfo"]["targetId"]):
continue

await self.send_command("Target.attachToTarget", {"targetId": message["params"]["targetInfo"]["targetId"], "flatten": True}, None, False)

async def on_tab_update(self):
Expand All @@ -301,6 +312,9 @@ async def on_tab_update(self):
if "method" in message and message["method"] == "Target.targetInfoChanged":
target_info = message["params"]["targetInfo"]

if not await self._tab_exists(message["params"]["targetInfo"]["targetId"]):
continue

for connected_tab in self.connected_tabs:
if target_info["targetId"] == connected_tab.id:
reinject = False
Expand Down Expand Up @@ -350,6 +364,42 @@ async def on_tab_detach(self):
Log(f"Disconnected from tab: {tab.title}")
self.connected_tabs.remove(tab)

async def sanity_check_tabs(self):
while True:
try:
result = await self.send_command("Target.getTargets", {}, None, True)
target_infos = result["result"]["targetInfos"]
target_ids = [x["targetId"] for x in target_infos if x["type"] == "page"]
for x in self.connected_tabs: # Remove tabs that are no longer connected
if x.id not in target_ids:
Log(f"Disconnected from tab: {x.title}")
self.connected_tabs.remove(x)

connected_ids = [x.id for x in self.connected_tabs]
for x in target_infos:
if x["targetId"] not in connected_ids: # Attach tabs that are not connected
await self.send_command("Target.attachToTarget", {"targetId": x["targetId"], "flatten": True}, None, False)
else:
for connected_tab in self.connected_tabs: # Update info on tabs that are connected
if connected_tab.id == x["targetId"]:
reinject = False
if (x["title"] != connected_tab.title):
connected_tab.title = x["title"]
reinject = True

if (x["url"] != connected_tab.url):
connected_tab.url = x["url"]
reinject = True

if reinject:
asyncio.create_task(connected_tab.force_reinject())

break
except:
pass

await asyncio.sleep(5)

async def css_health_check(self):
while True:
for tab in self.connected_tabs:
Expand All @@ -365,7 +415,7 @@ async def health_check(self):
await asyncio.sleep(3)
try:
async with aiohttp.ClientSession() as web:
res = await web.get(f"http://localhost:8080/json/version", timeout=3)
res = await web.get(f"http://127.0.0.1:8080/json/version", timeout=3)

if (res.status != 200):
raise Exception(f"/json/version returned {res.status}")
Expand All @@ -384,7 +434,7 @@ async def health_check(self):
x.put_nowait(data)

except Exception as e:
Log(f"[Browser Health Check] {str(e)}")
Result(False, f"[Health Check] {str(e)}")

try:
await self.close_websocket()
Expand All @@ -404,8 +454,8 @@ def get_tabs(tab_name : str) -> List[BrowserTabHook]:
if tab.compare(tab_name):
tabs.append(tab)

if tabs == []:
Log(f"[Warn] get_tabs({tab_name}) returned []. All tabs: {str([x.title for x in HOOK.connected_tabs])}")
#if tabs == []:
# Log(f"[Warn] get_tabs({tab_name}) returned []. All tabs: {str([x.title for x in HOOK.connected_tabs])}")

return tabs

Expand Down
8 changes: 3 additions & 5 deletions css_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async def load(self) -> Result:
async def inject(self) -> Result:
for tab_name in self.tabs:
for uuid in self.uuids[tab_name]:
Log(f"-{uuid} @ {tab_name}")
res = await remove(tab_name, uuid)

if (self.css is None):
Expand All @@ -51,7 +50,7 @@ async def inject(self) -> Result:
if not res.success:
return res

Log(f"+{str(res.message)} @ {tab_name}")
# Log(f"+{str(res.message)} @ {tab_name}")
self.uuids[tab_name].append(str(res.message))
except Exception as e:
return Result(False, str(e))
Expand All @@ -75,7 +74,7 @@ async def inject_with_tab(self, tab : CssTab) -> Result:
if not res.success:
return res

Log(f"+{str(res.message)} @ {tab_name}")
# Log(f"+{str(res.message)} @ {tab_name}")
self.uuids[tab_name].append(str(res.message))
except Exception as e:
return Result(False, str(e))
Expand All @@ -89,7 +88,6 @@ async def remove(self) -> Result:

try:
for x in self.uuids[tab_name]:
Log(f"-{x} @ {tab_name}")
res = await remove(tab_name, x)
#if not res["success"]:
# return Result(False, res["result"])
Expand All @@ -103,7 +101,7 @@ async def remove(self) -> Result:
return Result(True)

DEFAULT_MAPPINGS = {
"desktop": ["Steam.*"],
"desktop": ["Steam|SteamLibraryWindow"],
"desktopchat": ["!friendsui-container"],
"desktoppopup": ["OverlayBrowser_Browser", "SP Overlay:.*", "notificationtoasts_.*", "SteamBrowser_Find", "OverlayTab\\d+_Find", "!ModalDialogPopup", "!FullModalOverlay"],
"desktopoverlay": ["desktoppopup"],
Expand Down
Loading