diff options
| author | marios <marios8543@gmail.com> | 2022-04-18 15:57:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-18 15:57:51 +0300 |
| commit | fa776f0d0b7b4ca7071f0aa912be84e81caf6b61 (patch) | |
| tree | 535f6f0bb71ab97f17a0ef21eb8f0491ae4ca87d /plugin_loader/templates | |
| parent | 4576fed01baac066a8550018a0922739cc2f8985 (diff) | |
| download | decky-loader-fa776f0d0b7b4ca7071f0aa912be84e81caf6b61.tar.gz decky-loader-fa776f0d0b7b4ca7071f0aa912be84e81caf6b61.zip | |
Callsigns (#37)v1.2.0
* Plugin callsigns, filechangehandler thread bug fix, plugin file perms
- Plugins are now assigned a callsign (a random string), which they use for all internal identification, like resource fetching and method calls. This is to ensure that plugins only access their own resources and methods.
- Made FileChangeHandler send off events to a queue, that is then consumed by the Loader, instead of calling import_plugin on its own, since that caused weird issues with the event loop and the thread watchdog is using.
- Plugins are now owned by root and have read-only permissions. This is handled automatically.
* Improved general look and feel of plugin tab
* Make all plugin entries have the same padding between them
* Make "No plugins installed" text look the same as "No new notifications"
Co-authored-by: WerWolv <werwolv98@gmail.com>
Diffstat (limited to 'plugin_loader/templates')
| -rw-r--r-- | plugin_loader/templates/plugin_view.html | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/plugin_loader/templates/plugin_view.html b/plugin_loader/templates/plugin_view.html index 6016a7ae..9d7ba1bc 100644 --- a/plugin_loader/templates/plugin_view.html +++ b/plugin_loader/templates/plugin_view.html @@ -7,64 +7,70 @@ }); }, false); - function loadPlugin(name) { + function loadPlugin(callsign, name) { this.parent.postMessage("PLUGIN_LOADER__"+name, "https://steamloopback.host"); - location.href = `/plugins/load_main/${name}`; + location.href = `/plugins/load_main/${callsign}`; } </script> {% if not plugins|length %} -<div class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable" - style="--indent-level:0;"> - <div class="basicdialog_FieldChildren_279n8" style="color: white; font-size: large; padding-top: 10px;"> - No plugins installed :( + <div class="quickaccessmenu_TabGroupPanel_1QO7b Panel Focusable"> + <div class="quickaccesscontrols_EmptyNotifications_3ZjbM" style="padding-top:7px;"> + No plugins installed + </div> </div> -</div> {% endif %} <div class="quickaccessmenu_TabGroupPanel_1QO7b Panel Focusable"> {% for plugin in plugins %} - {% if plugin.tile_view_html|length %} - <div class="quickaccesscontrols_PanelSectionRow_26R5w"> - <div onclick="loadPlugin('{{ plugin.name }}')" - class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable" - style="--indent-level:0;"> - <iframe id="tile_view_iframe_{{ plugin.name }}" style="display:block; padding: 0; border: none;" scrolling="no" - src="/plugins/load_tile/{{ plugin.name }}"></iframe> - <script> - (function() { - let iframe = document.getElementById("tile_view_iframe_{{ plugin.name }}"); - tile_iframes.push(document.getElementById("tile_view_iframe_{{ plugin.name }}")); - iframe.onload = function() { - let html = iframe.contentWindow.document.children[0]; - let last_height = 0; - setInterval(function() { - let height = iframe.contentWindow.document.children[0].scrollHeight; - if (height != last_height) { - iframe.height = height + "px"; - last_height = height; - } - }, 100); - iframe.contentWindow.document.body.onclick = function () { - loadPlugin('{{ plugin.name }}'); - }; - } - })(); - </script> + {% if plugin.tile_view_html|length %} + <div class="quickaccesscontrols_PanelSectionRow_26R5w"> + <div onclick="loadPlugin('{{ plugin.callsign }}', '{{ plugin.name }}')" + class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable" + style="--indent-level:0; margin: 0px; padding: 0px; padding-top: 8px;"> + <iframe id="tile_view_iframe_{{ plugin.callsign }}" + scrolling="no" marginwidth="0" marginheight="0" + hspace="0" vspace="0" frameborder="0" + style="border-radius: 2px;" + src="/plugins/load_tile/{{ plugin.callsign }}"> + </iframe> + <script> + (function() { + let iframe = document.getElementById("tile_view_iframe_{{ plugin.callsign }}"); + tile_iframes.push(document.getElementById("tile_view_iframe_{{ plugin.callsign }}")); + + iframe.onload = function() { + let html = iframe.contentWindow.document.children[0]; + let last_height = 0; + + setInterval(function() { + let height = iframe.contentWindow.document.children[0].scrollHeight; + if (height != last_height) { + iframe.height = height + "px"; + last_height = height; + } + }, 100); + + iframe.contentWindow.document.body.onclick = function () { + loadPlugin('{{ plugin.callsign }}', '{{ plugin.name }}'); + }; + } + })(); + </script> + </div> </div> - </div> {% else %} - <div class="quickaccesscontrols_PanelSectionRow_26R5w"> - <div onclick="loadPlugin('{{ plugin.name }}')" - class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable" - style="--indent-level:0;"> - <div class="basicdialog_FieldChildren_279n8"> - <button type="button" tabindex="0" - class="DialogButton _DialogLayout Secondary basicdialog_Button_1Ievp Focusable">{{ plugin.name - }}</button> + <div class="quickaccesscontrols_PanelSectionRow_26R5w"> + <div onclick="loadPlugin('{{ plugin.callsign }}', '{{ plugin.name }}')" + class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable" + style="--indent-level:0; margin: 0px; padding: 0px; padding-top: 8px;"> + <div class="basicdialog_FieldChildren_279n8"> + <button type="button" tabindex="0" + class="DialogButton _DialogLayout Secondary basicdialog_Button_1Ievp Focusable">{{ plugin.name }} + </button> + </div> </div> </div> - </div> {% endif %} - {% endfor %} + {% endfor %} </div> |
