Skip to content

Commit 4dce92b

Browse files
committed
feat: flexibilized ad options
1 parent 1b1bea9 commit 4dce92b

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

core/components/DynamicAds.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import xss from 'xss';
33
import defaultAds from '../../dynamicAds.json';
44
import got from '@core/extras/got.js';
55
import consoleFactory from '@extras/console';
6+
import { convars } from '@core/globalData';
67
const console = consoleFactory(modulename);
78

89

@@ -24,10 +25,18 @@ export default class DynamicAds {
2425
this.adOptions = false;
2526

2627
//Set default ads
27-
if (Array.isArray(defaultAds.login) && Array.isArray(defaultAds.main)) {
28+
let loginAds, mainAds;
29+
if(convars.isZapHosting){
30+
loginAds = defaultAds.loginZap;
31+
mainAds = defaultAds.mainZap;
32+
} else {
33+
loginAds = defaultAds.login;
34+
mainAds = defaultAds.main;
35+
}
36+
if (Array.isArray(loginAds) && Array.isArray(mainAds)) {
2837
this.adOptions = {
29-
login: cleanAds(defaultAds.login),
30-
main: cleanAds(defaultAds.main),
38+
login: cleanAds(loginAds),
39+
main: cleanAds(mainAds),
3140
};
3241
}
3342

@@ -46,10 +55,18 @@ export default class DynamicAds {
4655
const indexURL = 'https://raw.githubusercontent.com/tabarra/txAdmin/master/dynamicAds.json';
4756
try {
4857
const res = await got(indexURL).json();
49-
if (Array.isArray(defaultAds.login) && Array.isArray(defaultAds.main)) {
58+
let loginAds, mainAds;
59+
if(convars.isZapHosting){
60+
loginAds = res.loginZap;
61+
mainAds = res.mainZap;
62+
} else {
63+
loginAds = res.login;
64+
mainAds = res.main;
65+
}
66+
if (Array.isArray(loginAds) && Array.isArray(mainAds)) {
5067
this.adOptions = {
51-
login: cleanAds(res.login),
52-
main: cleanAds(res.main),
68+
login: cleanAds(loginAds),
69+
main: cleanAds(mainAds),
5370
};
5471
this.adIndex = {
5572
login: 0,

docs/dev_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
109109
- [x] bot should check if it has any dangerous permission
110110
- [x] improve zap/ptero detection
111-
- [ ] flexibilized ad options
111+
- [x] flexibilized ad options
112112
- [ ] stats:
113113
- [ ] adapt the new runtime specs, separate temp stats from classic stats
114114
- [ ] add bot enabled / whitelist back into stats

dynamicAds.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,22 @@
1515
"linkDesktop": "http://zap-hosting.com/txAdmin5",
1616
"linkMobile": "http://zap-hosting.com/txAdmin7"
1717
}
18+
],
19+
"loginZap": [
20+
{
21+
"text": "DDoS protected & preconfigured FiveM txAdmin servers",
22+
"logoLightMode": "img/zap256_black.png",
23+
"logoDarkMode": "img/zap256_white.png",
24+
"link": "http://zap-hosting.com/txAdmin3"
25+
}
26+
],
27+
"mainZap": [
28+
{
29+
"text": "DDoS protected & preconfigured <br> FiveM txAdmin servers",
30+
"logoLightMode": "img/zap256_black.png",
31+
"logoDarkMode": "img/zap256_white.png",
32+
"linkDesktop": "http://zap-hosting.com/txAdmin5",
33+
"linkMobile": "http://zap-hosting.com/txAdmin7"
34+
}
1835
]
1936
}

0 commit comments

Comments
 (0)