summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin_loader/browser.py5
-rw-r--r--plugin_loader/loader.py2
-rw-r--r--plugin_loader/main.py2
-rw-r--r--plugin_loader/static/plugin_page.js7
-rw-r--r--plugin_loader/utilities.py23
5 files changed, 17 insertions, 22 deletions
diff --git a/plugin_loader/browser.py b/plugin_loader/browser.py
index e9c9bb53..e7e4875c 100644
--- a/plugin_loader/browser.py
+++ b/plugin_loader/browser.py
@@ -27,7 +27,6 @@ class PluginBrowser:
server_instance.add_routes([
web.post("/browser/install_plugin", self.install_plugin),
web.get("/browser/redirect", self.redirect_to_store),
- web.post("/browser/close_store", self.close_store)
])
def _unzip_to_plugin_dir(self, zip, name, hash):
@@ -73,10 +72,6 @@ class PluginBrowser:
async def redirect_to_store(self, request):
return web.Response(status=302, headers={"Location": self.store_url})
- async def close_store(self, request):
- await inject_to_tab("SP", "window.PLUGIN_STORE_TAB_INSTANCE.SetVisible(false)")
- await inject_to_tab("SP", "SteamClient.BrowserView.Destroy(window.PLUGIN_STORE_TAB_INSTANCE)")
-
async def install_plugin(self, request):
data = await request.post()
get_event_loop().create_task(self.request_plugin_install(data["artifact"], data["version"], data["hash"]))
diff --git a/plugin_loader/loader.py b/plugin_loader/loader.py
index fea5f149..681c8251 100644
--- a/plugin_loader/loader.py
+++ b/plugin_loader/loader.py
@@ -121,7 +121,7 @@ class Loader:
return await self.callsigns[callsign].execute_method(method_name, kwargs)
async def get_steam_resource(self, request):
- tab = (await get_tabs())[0]
+ tab = await get_tab("QuickAccess")
try:
return web.Response(text=await tab.get_steam_resource(f"https://steamloopback.host/{request.match_info['path']}"), content_type="text/html")
except Exception as e:
diff --git a/plugin_loader/main.py b/plugin_loader/main.py
index 48f45231..57cfc52d 100644
--- a/plugin_loader/main.py
+++ b/plugin_loader/main.py
@@ -7,7 +7,7 @@ CONFIG = {
"server_port": int(getenv("SERVER_PORT", "1337")),
"live_reload": getenv("LIVE_RELOAD", "1") == "1",
"log_level": {"CRITICAL": 50, "ERROR": 40, "WARNING":30, "INFO": 20, "DEBUG": 10}[getenv("LOG_LEVEL", "INFO")],
- "store_url": getenv("STORE_URL", "https://plugins.deckbrew.xyz"),
+ "store_url": getenv("STORE_URL", "https://beta.deckbrew.xyz"),
"log_base_events": getenv("LOG_BASE_EVENTS", "0")=="1"
}
diff --git a/plugin_loader/static/plugin_page.js b/plugin_loader/static/plugin_page.js
index d571cfe3..b327cd1c 100644
--- a/plugin_loader/static/plugin_page.js
+++ b/plugin_loader/static/plugin_page.js
@@ -67,7 +67,7 @@ function addPluginInstallPrompt(artifact, version, request_id) {
function createTitle(text) {
return `
- <div id="plugin_title" class="quickaccessmenu_Title_34nl5">${text}${SHOP_ICON}</div>
+ <div class="quickaccessmenu_Title_34nl5"><div id="plugin_title">${text}</div>${SHOP_ICON}</div>
`;
}
@@ -93,10 +93,10 @@ function addPluginInstallPrompt(artifact, version, request_id) {
inject();
document.getElementById("plugin_title").onclick = function() {
reloadIframe();
- document.getElementById("plugin_title").innerHTML = `Plugins ${SHOP_ICON}`;
+ document.getElementById("plugin_title").innerText = `Plugins`;
+ document.getElementById("open_shop_button").style.display = 'block';
}
document.getElementById("open_shop_button").onclick = function(ev) {
- ev.stopPropagation();
console.debug(JSON.stringify({
"id": 1,
"method": "open_plugin_store",
@@ -106,6 +106,7 @@ function addPluginInstallPrompt(artifact, version, request_id) {
window.onmessage = function(ev) {
let title = ev.data;
if (title.startsWith("PLUGIN_LOADER__")) {
+ document.getElementById("open_shop_button").style.display = 'none';
document.getElementById("plugin_title").innerHTML = `
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-square-fill" viewBox="0 0 16 16">
<path d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12zm-4.5-6.5H5.707l2.147-2.146a.5.5 0 1 0-.708-.708l-3 3a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708-.708L5.707 8.5H11.5a.5.5 0 0 0 0-1z"/>
diff --git a/plugin_loader/utilities.py b/plugin_loader/utilities.py
index 1cbecbf7..a2824d3f 100644
--- a/plugin_loader/utilities.py
+++ b/plugin_loader/utilities.py
@@ -1,5 +1,5 @@
from aiohttp import ClientSession
-from injector import get_tab, get_tabs, inject_to_tab
+from injector import inject_to_tab
import uuid
class Utilities:
@@ -107,15 +107,14 @@ class Utilities:
}
async def open_plugin_store(self):
- if self.context.plugin_browser.store_url in await get_tabs():
- return
- res = await inject_to_tab("SP", """
- window.PLUGIN_STORE_TAB_INSTANCE = (function() {
- let i = SteamClient.BrowserView.Create()
- i.SetBounds(0, 60, 1280, 800-59-60)
- i.LoadURL('http://127.0.0.1:1337/browser/redirect')
- i.SetVisible(true);
- return i;
+ await inject_to_tab("SP", """
+ (function() {
+ wpRequire = webpackJsonp.push([[], { get_require: (mod, _exports, wpRequire) => mod.exports = wpRequire }, [["get_require"]]]);
+ const all = () => Object.keys(wpRequire.c).map((x) => wpRequire.c[x].exports).filter((x) => x);
+ router = all().map(m => {
+ if (typeof m !== "object") return undefined;
+ for (let prop in m) { if (m[prop]?.Navigate) return m[prop]}
+ }).find(x => x)
+ router.NavigateToExternalWeb("http://127.0.0.1:1337/browser/redirect")
})();
- """)
- setattr(self, "store_is_open", True) \ No newline at end of file
+ """) \ No newline at end of file