Skip to content

Commit b54a30d

Browse files
committed
Add button in API settings to view address of API config page
1 parent 9d1ae49 commit b54a30d

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

resources/language/resource.language.en_gb/strings.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ msgid "IP whitelist (comma delimited)"
826826
msgstr ""
827827

828828
msgctxt "#30630"
829-
msgid ""
829+
msgid "Check API configuration page address"
830830
msgstr ""
831831

832832
msgctxt "#30631"

resources/lib/youtube_plugin/kodion/script_actions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ def _config_actions(context, action, *_args):
127127
else:
128128
ui.show_notification(context.localize('httpd.not.running'))
129129

130+
elif action == 'show_api_config_page_address':
131+
context.ipc_exec(SERVER_WAKEUP, timeout=5, payload={'force': True})
132+
url = httpd_status(context, path=PATHS.API)
133+
if url:
134+
ui.on_ok(context.localize('api.config'),
135+
context.localize('go.to.x', ui.bold(url)))
136+
else:
137+
ui.show_notification(context.localize('httpd.not.running'))
138+
130139
elif action == 'geo_location':
131140
locator = Locator(context)
132141
locator.locate_requester()

resources/settings.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,25 @@
330330
<control type="toggle"/>
331331
</setting>
332332
</group>
333-
<group id="2" label="30633">
333+
<group id="2" label="30634">
334334
<setting id="youtube.api.config.page" type="boolean" label="30632" help="">
335335
<level>0</level>
336336
<default>false</default>
337337
<control type="toggle"/>
338338
</setting>
339+
<setting id="youtube.api.config.page.address" type="action" label="30630" help="30633">
340+
<level>0</level>
341+
<constraints>
342+
<allowempty>true</allowempty>
343+
</constraints>
344+
<dependencies>
345+
<dependency type="enable">
346+
<condition setting="youtube.api.config.page" operator="is">true</condition>
347+
</dependency>
348+
</dependencies>
349+
<data>RunScript($ID,config/show_api_config_page_address)</data>
350+
<control format="action" type="button"/>
351+
</setting>
339352
</group>
340353
</category>
341354
<category id="folders" label="30516" help="">

0 commit comments

Comments
 (0)