Skip to content

Commit

Permalink
opt out web crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
simon300000 committed Sep 10, 2023
1 parent 4b82c07 commit 2e4cd55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,21 @@ export default {
this.$gtag.event('theme', {
'theme': this.theme
})
while (true) {
const { url } = await dispatch()
if (url) {
const data = await fetch(url).then(w => w.text())
receipt(url, data)
this.$gtag.event('Dispatch', {
event_name: 'dispatch',
code: JSON.parse(data).code
})
} else {
await wait(1000 * 20)
if (localStorage.noSpider !== 'true') {
while (true) {
const { url } = await dispatch()
if (url) {
const data = await fetch(url).then(w => w.text())
receipt(url, data)
this.$gtag.event('Dispatch', {
event_name: 'dispatch',
code: JSON.parse(data).code
})
} else {
await wait(1000 * 20)
}
await wait(1000 * 10)
}
await wait(1000 * 10)
}
},
watch: {
Expand Down
12 changes: 12 additions & 0 deletions src/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
Will make rank page slow and laggie, disable if you encounter problem
<br>
</label>
<label class="checkbox">
<input type="checkbox" v-model="noSpider">
Disable web crawler
<br>
Web crawler help MuseDash.moe to gather data, it will use some bandwidth (~6KB/s)
<br>
</label>
</p>
<br>
<p>
Expand Down Expand Up @@ -71,6 +78,7 @@ export default {
return {
rawEnabled: false,
vt: false,
noSpider: false,
log: 'loading...'
}
},
Expand All @@ -80,6 +88,9 @@ export default {
},
vt() {
localStorage.vt = String(this.vt)
},
noSpider() {
localStorage.noSpider = String(this.noSpider)
}
},
methods: mapMutations(['updateTitle', 'removeTitle']),
Expand All @@ -92,6 +103,7 @@ export default {
async mounted() {
this.rawEnabled = localStorage.rawEnabled === 'true'
this.vt = localStorage.vt === 'true'
this.noSpider = localStorage.noSpider === 'true'
this.log = await getLog()
}
}
Expand Down

0 comments on commit 2e4cd55

Please sign in to comment.