Fixed hostbanner not showing for dynamic host banners
This commit is contained in:
parent
583ac36a30
commit
1b9b1cd5e4
3 changed files with 21 additions and 17 deletions
|
@ -2246,16 +2246,7 @@
|
||||||
|
|
||||||
<div style="
|
<div style="
|
||||||
background:center no-repeat url(
|
background:center no-repeat url(
|
||||||
{{:property_virtualserver_hostbanner_gfx_url}}
|
{{:property_virtualserver_hostbanner_gfx_url}}{{:cache_tag}}
|
||||||
{{if property_virtualserver_hostbanner_gfx_interval > 0}}
|
|
||||||
{{*
|
|
||||||
date = Math.floor(Date.now() / 1000);
|
|
||||||
if (data.property_virtualserver_hostbanner_gfx_interval <= 60)
|
|
||||||
data.property_virtualserver_hostbanner_gfx_interval = 60;
|
|
||||||
date = Math.floor(date / data.property_virtualserver_hostbanner_gfx_interval) * data.property_virtualserver_hostbanner_gfx_interval;
|
|
||||||
}}
|
|
||||||
?ts={{*:date}}
|
|
||||||
{{/if}}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
client_away Value: '0'
|
client_away Value: '0'
|
||||||
client_away_message Value: ''
|
client_away_message Value: ''
|
||||||
*/
|
*/
|
||||||
import openBanList = Modals.openBanList;
|
|
||||||
import spawnConnectModal = Modals.spawnConnectModal;
|
|
||||||
|
|
||||||
class ControlBar {
|
class ControlBar {
|
||||||
private _muteInput: boolean;
|
private _muteInput: boolean;
|
||||||
|
@ -303,7 +301,7 @@ class ControlBar {
|
||||||
if(!this.handle.serverConnection) return;
|
if(!this.handle.serverConnection) return;
|
||||||
|
|
||||||
if(this.handle.permissions.neededPermission(PermissionType.B_CLIENT_BAN_LIST).granted(1)) {
|
if(this.handle.permissions.neededPermission(PermissionType.B_CLIENT_BAN_LIST).granted(1)) {
|
||||||
openBanList(this.handle);
|
Modals.openBanList(this.handle);
|
||||||
} else {
|
} else {
|
||||||
createErrorModal(tr("You dont have the permission"), tr("You dont have the permission to view the ban list")).open();
|
createErrorModal(tr("You dont have the permission"), tr("You dont have the permission to view the ban list")).open();
|
||||||
sound.play(Sound.ERROR_INSUFFICIENT_PERMISSIONS);
|
sound.play(Sound.ERROR_INSUFFICIENT_PERMISSIONS);
|
||||||
|
|
|
@ -159,12 +159,27 @@ class Hostbanner {
|
||||||
for(let key in server.properties)
|
for(let key in server.properties)
|
||||||
properties["property_" + key] = server.properties[key];
|
properties["property_" + key] = server.properties[key];
|
||||||
|
|
||||||
|
if(server.properties.virtualserver_hostbanner_gfx_interval > 0) {
|
||||||
|
const update_interval = Math.min(server.properties.virtualserver_hostbanner_gfx_interval, 60);
|
||||||
|
const update_timestamp = (Math.floor((Date.now() / 1000) / update_interval) * update_interval).toString();
|
||||||
|
try {
|
||||||
|
const url = new URL(server.properties.virtualserver_hostbanner_gfx_url);
|
||||||
|
if(url.search.length == 0)
|
||||||
|
properties["cache_tag"] = "?_ts=" + update_timestamp;
|
||||||
|
else
|
||||||
|
properties["cache_tag"] = "&_ts=" + update_timestamp;
|
||||||
|
} finally {
|
||||||
|
properties["cache_tag"] = "&_ts=" + update_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updater = setTimeout(() => this.update(), update_interval * 1000);
|
||||||
|
} else {
|
||||||
|
properties["cache_tag"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const rendered = $("#tmpl_selected_hostbanner").renderTag(properties);
|
const rendered = $("#tmpl_selected_hostbanner").renderTag(properties);
|
||||||
|
|
||||||
console.debug(tr("Hostbanner has been loaded"));
|
console.debug(tr("Hostbanner has been loaded"));
|
||||||
if(server.properties.virtualserver_hostbanner_gfx_interval > 0)
|
|
||||||
this.updater = setTimeout(() => this.update(), Math.min(server.properties.virtualserver_hostbanner_gfx_interval, 60) * 1000);
|
|
||||||
|
|
||||||
return Promise.resolve(rendered);
|
return Promise.resolve(rendered);
|
||||||
/*
|
/*
|
||||||
const image = rendered.find("img");
|
const image = rendered.find("img");
|
||||||
|
|
Loading…
Add table
Reference in a new issue