File tree Expand file tree Collapse file tree 8 files changed +84
-2
lines changed Expand file tree Collapse file tree 8 files changed +84
-2
lines changed Original file line number Diff line number Diff line change 1
1
// Put your custom JS code here
2
+
3
+ // self-hosting view.
4
+ const getSelfhost = ( ) => {
5
+ return localStorage . getItem ( 'selfhost' ) || 'no' ;
6
+ } ;
7
+
8
+ const setSelfhost = ( selfhost ) => {
9
+ localStorage . setItem ( 'selfhost' , selfhost ) ;
10
+ document . documentElement . setAttribute ( 'data-selfhost' , selfhost ) ;
11
+ } ;
12
+
13
+ setSelfhost ( getSelfhost ( ) ) ;
14
+
15
+ window . addEventListener ( 'DOMContentLoaded' , ( ) => {
16
+ document . querySelectorAll ( '[data-selfhost-value]' ) . forEach ( ( element ) => {
17
+ element . addEventListener ( 'click' , ( event ) => {
18
+ const selfhost = element . getAttribute ( 'data-selfhost-value' ) ;
19
+ setSelfhost ( selfhost ) ;
20
+ } ) ;
21
+ }
22
+ ) } ) ;
Original file line number Diff line number Diff line change @@ -147,6 +147,32 @@ pre.shiki {
147
147
opacity : var (--ec-frm-inlBtnBgActOpa );
148
148
}
149
149
150
+ // show active server if self-hosting view enabled
151
+ html [data-selfhost = " yes" ] {
152
+ .icon-tabler-server {
153
+ display : block ;
154
+ }
155
+
156
+ .icon-tabler-server-off {
157
+ display : none ;
158
+ }
159
+ }
160
+
161
+ // hide active server if self-hosting view disabled
162
+ html [data-selfhost = " no" ] {
163
+ .icon-tabler-server {
164
+ display : none ;
165
+ }
166
+
167
+ .icon-tabler-server-off {
168
+ display : block ;
169
+ }
170
+
171
+ .selfhosting {
172
+ display : none ;
173
+ }
174
+ }
175
+
150
176
@media (hover : hover) {
151
177
.highlight .copy button {
152
178
opacity : 0 ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ module.exports = {
26
26
'data-global-alert' ,
27
27
'data-pane' , // tabs.js
28
28
'data-popper-placement' ,
29
+ 'data-selfhost' ,
29
30
'data-sizes' ,
30
31
'data-toggle-tab' , // tabs.js
31
32
'id' ,
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ contains an embed, it is serialized and saved in JSON format.
28
28
29
29
Message logs on the official YAGPDB instance will be automatically deleted after 30 days of their creation.
30
30
31
- If you're self-hosting, see [ Message Log Purge] ( #message-log-purge-self-hosting-only ) for more information.
31
+ If you're self-hosting, see [ Message Log Purge] ( #message-log-purge ) for more information.
32
32
33
33
{{< /callout >}}
34
34
@@ -114,8 +114,12 @@ channels.
114
114
Users with write access to the control panel may delete individual logs or delete all logs on the server using the
115
115
control panel.
116
116
117
- ## Message Log Purge [ Self-hosting only]
117
+ {{< selfhosting >}}
118
+
119
+ ## Message Log Purge
118
120
119
121
If you are self-hosting your own instance of YAGPDB, you can set ` enable_message_log_purge=true ` to automatically purge
120
122
message logs older than 30 days. This option is enabled on the official instance of YAGPDB hosted by Botlabs but is
121
123
disabled by default on a fresh self-host.
124
+
125
+ {{< /selfhosting >}}
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ If a new user who verifies is detected as an alt but none of their associated ac
97
97
send a log to the verification log channel if specified, identifying the new user as an alt and listing other users who
98
98
verified at the same IP address.
99
99
100
+ {{< selfhosting >}}
101
+
100
102
### Disable Alt Detection Globally
101
103
102
104
For self hosters, the environment variable to enable this feature is ` verification.track_ips ` . It is ` true ` by default.
@@ -112,3 +114,5 @@ Do not proceed unless you are hosting your own version of the YAGPDB codebase.
112
114
Verification requires the ` google.recaptcha_secret ` and ` google.recaptcha_site_key ` env variables to be configured and
113
115
valid. To get a reCAPTCHA secret and site key, [ register a site on
114
116
reCAPTCHA] ( https://www.google.com/recaptcha/admin/create ) and copy the generated secret and key.
117
+
118
+ {{< /selfhosting >}}
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ You can assign your premium slots to any server with YAGPDB in it and no existin
127
127
128
128
![ Redeemed Premium Slots] ( slots_premium.png )
129
129
130
+ {{< selfhosting >}}
131
+
130
132
## Self Hosting YAGPDB
131
133
132
134
Do not proceed unless you are hosting your own version of the YAGPDB codebase.
@@ -153,3 +155,5 @@ recommended you familiarize yourself with the codebase before making changes. Fi
153
155
defined and alter their values as you wish.
154
156
155
157
![ Example of limit definitions in Advanced Automoderator] ( limits_example.png )
158
+
159
+ {{< /selfhosting >}}
Original file line number Diff line number Diff line change @@ -272,6 +272,24 @@ <h5 class="offcanvas-title fw-bold" id="offcanvasNavMainLabel">{{ .Site.Params.T
272
272
</ ul >
273
273
{{ end -}}
274
274
275
+ <!-- self-hosting view -->
276
+ < button id ="selfHosting " class ="btn btn-link mx-auto nav-link p-0 ms-lg-2 me-lg-1 " type ="button " aria-label ="Toggle self-hosting view ">
277
+ < svg data-selfhost-value ="yes " xmlns ="http://www.w3.org/2000/svg " class ="icon icon-tabler icon-tabler-server-off " width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="2 " stroke ="currentColor " fill ="none " stroke-linecap ="round " stroke-linejoin ="round ">
278
+ < path stroke ="none " d ="M0 0h24v24H0z " fill ="none "/>
279
+ < path d ="M12 12h-6a3 3 0 0 1 -3 -3v-2c0 -1.083 .574 -2.033 1.435 -2.56m3.565 -.44h10a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-2 " />
280
+ < path d ="M16 12h2a3 3 0 0 1 3 3v2m-1.448 2.568a2.986 2.986 0 0 1 -1.552 .432h-12a3 3 0 0 1 -3 -3v-2a3 3 0 0 1 3 -3h6 " />
281
+ < path d ="M7 8v.01 " />
282
+ < path d ="M7 16v.01 " />
283
+ < path d ="M3 3l18 18 " />
284
+ </ svg >
285
+ < svg data-selfhost-value ="no " xmlns ="http://www.w3.org/2000/svg " class ="icon icon-tabler icon-tabler-server " width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="2 " stroke ="currentColor " fill ="none " stroke-linecap ="round " stroke-linejoin ="round ">
286
+ < path stroke ="none " d ="M0 0h24v24H0z " fill ="none "/>
287
+ < path d ="M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z " />
288
+ < path d ="M3 12m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z " />
289
+ < path d ="M7 8l0 .01 " />
290
+ < path d ="M7 16l0 .01 " />
291
+ </ svg >
292
+ </ button >
275
293
276
294
<!-- Navbar button mobile -->
277
295
{{ if site.Params.doks.navBarButton -}}
Original file line number Diff line number Diff line change
1
+ {{/* wraps the inner content in a div with a class of "selfhosting", such that it can be conditionally hidden by some JS code. */}}
2
+ < div class ="selfhosting ">
3
+ {{ .Inner | $.Page.RenderString }}
4
+ </ div >
You can’t perform that action at this time.
0 commit comments