mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Add trick to access.lua to be able to inject custom/theme css and js when in apps as well
This commit is contained in:
parent
ac3dc39f9a
commit
2f24e82f38
2 changed files with 19 additions and 0 deletions
|
@ -315,6 +315,14 @@ if hlp.is_logged_in() then
|
||||||
if string.match(ngx.var.uri, "^/ynhpanel.json$") then
|
if string.match(ngx.var.uri, "^/ynhpanel.json$") then
|
||||||
hlp.serve("/yunohost/sso/assets/js/ynhpanel.json")
|
hlp.serve("/yunohost/sso/assets/js/ynhpanel.json")
|
||||||
end
|
end
|
||||||
|
-- TODO : don't forget to open a PR to enable access to those
|
||||||
|
-- in yunohost_panel.conf.inc
|
||||||
|
if string.match(ngx.var.uri, "^/ynhpanel_custom.js$") then
|
||||||
|
hlp.serve("/yunohost/sso/assets/themes/"..conf.theme.."/custom.js")
|
||||||
|
end
|
||||||
|
if string.match(ngx.var.uri, "^/ynhpanel_custom.css$") then
|
||||||
|
hlp.serve("/yunohost/sso/assets/themes/"..conf.theme.."/custom.css")
|
||||||
|
end
|
||||||
|
|
||||||
-- If user has no access to this URL, redirect him to the portal
|
-- If user has no access to this URL, redirect him to the portal
|
||||||
if not hlp.has_access() then
|
if not hlp.has_access() then
|
||||||
|
|
|
@ -262,6 +262,17 @@ function init_portal_button_and_overlay()
|
||||||
portalStyle.setAttribute("type", "text/css");
|
portalStyle.setAttribute("type", "text/css");
|
||||||
portalStyle.setAttribute("href", '/ynhpanel.css');
|
portalStyle.setAttribute("href", '/ynhpanel.css');
|
||||||
document.getElementsByTagName("head")[0].insertBefore(portalStyle, null);
|
document.getElementsByTagName("head")[0].insertBefore(portalStyle, null);
|
||||||
|
// Inject custom / theme css
|
||||||
|
var customStyle = document.createElement("link");
|
||||||
|
customStyle.setAttribute("rel", "stylesheet");
|
||||||
|
customStyle.setAttribute("type", "text/css");
|
||||||
|
customStyle.setAttribute("href", '/ynhpanel_custom.css');
|
||||||
|
document.getElementsByTagName("head")[0].insertBefore(customStyle, null);
|
||||||
|
// Inject custom / theme js
|
||||||
|
var customScript = document.createElement("script");
|
||||||
|
customScript.setAttribute("type", "text/javascript");
|
||||||
|
customScript.setAttribute("src", '/ynhpanel_custom.js');
|
||||||
|
document.getElementsByTagName("head")[0].insertBefore(customScript, null);
|
||||||
|
|
||||||
// Bind portal button
|
// Bind portal button
|
||||||
// FIXME : this somehow prevent the portalButton
|
// FIXME : this somehow prevent the portalButton
|
||||||
|
|
Loading…
Reference in a new issue