mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-15 16:22:44 +00:00
Compare commits
4 commits
b9d650c237
...
c0046975a2
Author | SHA1 | Date | |
---|---|---|---|
c0046975a2 | |||
d288a54108 | |||
9ba81c36cb | |||
966b76b829 |
6 changed files with 35 additions and 13 deletions
|
@ -1 +1,2 @@
|
||||||
VITE_API_BASE_URL= 'http://localhost:8080'
|
VITE_API_BASE_URL= 'http://localhost:8080'
|
||||||
|
VITE_METER_SITE = ''
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
VITE_METER_SITE = 'k5.vicicode.com,k5.vicicode.cn,k5.lhw711.cn,mm.md,k5.mm.md'
|
13
src/App.vue
13
src/App.vue
|
@ -35,7 +35,7 @@
|
||||||
window.TextDecoder = TextDecoder;
|
window.TextDecoder = TextDecoder;
|
||||||
|
|
||||||
// 遥测
|
// 遥测
|
||||||
if(location.hostname == 'k5.vicicode.com' || location.hostname == 'k5.vicicode.cn' || location.hostname == 'k5.lhw711.cn' || location.hostname == 'mm.md' || location.hostname == 'k5.mm.md'){
|
if(import.meta.env.VITE_METER_SITE.split(',').indexOf(location.hostname) !== -1){
|
||||||
const aegis = new Aegis({
|
const aegis = new Aegis({
|
||||||
id: 'yr5DeslJkz3Qn20jg0', // 上报 id
|
id: 'yr5DeslJkz3Qn20jg0', // 上报 id
|
||||||
reportApiSpeed: true, // 接口测速
|
reportApiSpeed: true, // 接口测速
|
||||||
|
@ -73,9 +73,9 @@
|
||||||
return lang;
|
return lang;
|
||||||
});
|
});
|
||||||
|
|
||||||
fetch('https://myip.ipip.net/json').then(e=>e.json()).then(e=>{
|
if(location.hostname === 'k5.vicicode.com'){
|
||||||
if(e.data.location[0] == '中国' && location.hostname != 'k5.vicicode.cn'){
|
fetch('/cdn-cgi/trace').then(e=>e.text()).then(e=>{
|
||||||
if(!(localStorage.getItem('cnNotice') && parseInt(localStorage.getItem('cnNotice') ?? '') > new Date().getTime() - 604800000)){
|
if(e.indexOf('loc=CN') !== -1){
|
||||||
DialogPlugin.confirm({
|
DialogPlugin.confirm({
|
||||||
header: '提示',
|
header: '提示',
|
||||||
body: '🚀 国内用户推荐访问国内镜像以获得极速体验~',
|
body: '🚀 国内用户推荐访问国内镜像以获得极速体验~',
|
||||||
|
@ -91,6 +91,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -39,7 +39,7 @@ app.use(i18n);
|
||||||
app.use(globalComponents);
|
app.use(globalComponents);
|
||||||
app.use(directive);
|
app.use(directive);
|
||||||
|
|
||||||
if(location.hostname == 'k5.vicicode.com' || location.hostname == 'k5.vicicode.cn' || location.hostname == 'k5.lhw711.cn' || location.hostname == 'mm.md' || location.hostname == 'k5.mm.md'){
|
if(import.meta.env.VITE_METER_SITE.split(',').indexOf(location.hostname) !== -1){
|
||||||
app.use(VueMatomo, {
|
app.use(VueMatomo, {
|
||||||
host: '//analytics.vicicode.com',
|
host: '//analytics.vicicode.com',
|
||||||
siteId: 2,
|
siteId: 2,
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Updater {
|
||||||
this.newScript = this.parserScript(newHtml);
|
this.newScript = this.parserScript(newHtml);
|
||||||
this.compare(this.oldScript, this.newScript)
|
this.compare(this.oldScript, this.newScript)
|
||||||
//这边给的是默认值15000,也可以自定义秒数
|
//这边给的是默认值15000,也可以自定义秒数
|
||||||
}, 15000);
|
}, 60000);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" field="lng" :label="$t('tool.longitude')">
|
<a-form-item :label-col-style="{ width: '25%' }" field="lng" :label="$t('tool.longitude')">
|
||||||
<a-input-number :precision="6" v-model="state.lng" />
|
<a-input-number ref="lngRef" :precision="6" v-model="state.lng" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" field="lat" :label="$t('tool.latitude')">
|
<a-form-item :label-col-style="{ width: '25%' }" field="lat" :label="$t('tool.latitude')">
|
||||||
<a-input-number :precision="6" v-model="state.lat" />
|
<a-input-number ref="latRef" :precision="6" v-model="state.lat" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" field="alt" :label="$t('tool.altitude')">
|
<a-form-item :label-col-style="{ width: '25%' }" field="alt" :label="$t('tool.altitude')">
|
||||||
<a-input-number :precision="0" v-model="state.alt" />
|
<a-input-number ref="altRef" :precision="0" v-model="state.alt" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label-col-style="{ width: '25%' }" label="">
|
<a-form-item :label-col-style="{ width: '25%' }" label="">
|
||||||
<a-space>
|
<a-space>
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, nextTick, onMounted, onUnmounted } from 'vue';
|
import { ref, reactive, nextTick, onMounted, onUnmounted } from 'vue';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import { eeprom_write, eeprom_reboot, eeprom_init, hexReverseStringToUint8Array, stringToUint8Array } from '@/utils/serial.js';
|
import { eeprom_write, eeprom_reboot, eeprom_init, hexReverseStringToUint8Array, stringToUint8Array } from '@/utils/serial.js';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
|
@ -108,6 +108,10 @@ const { loading, setLoading } = useLoading(true);
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
const lngRef : any = ref(null)
|
||||||
|
const latRef : any = ref(null)
|
||||||
|
const altRef : any = ref(null)
|
||||||
|
|
||||||
const state: {
|
const state: {
|
||||||
uuid: string,
|
uuid: string,
|
||||||
qrcode: string,
|
qrcode: string,
|
||||||
|
@ -165,8 +169,23 @@ const state: {
|
||||||
onMounted(async ()=>{
|
onMounted(async ()=>{
|
||||||
const rst = await (await fetch('https://mirror.ghproxy.com/https://raw.githubusercontent.com/palewire/ham-satellite-database/main/data/amsat-active-frequencies.json')).text()
|
const rst = await (await fetch('https://mirror.ghproxy.com/https://raw.githubusercontent.com/palewire/ham-satellite-database/main/data/amsat-active-frequencies.json')).text()
|
||||||
state.freqDb = JSON.parse(rst)
|
state.freqDb = JSON.parse(rst)
|
||||||
|
|
||||||
|
state.lng = parseFloat(localStorage.getItem('myLng') || '0')
|
||||||
|
state.lat = parseFloat(localStorage.getItem('myLat') || '0')
|
||||||
|
state.alt = parseFloat(localStorage.getItem('myAlt') || '0')
|
||||||
|
|
||||||
|
await lngRef.value.$forceUpdate()
|
||||||
|
await latRef.value.$forceUpdate()
|
||||||
|
await altRef.value.$forceUpdate()
|
||||||
|
state.lng = parseFloat(lngRef.value.inputRef.modelValue || '0')
|
||||||
|
state.lat = parseFloat(latRef.value.inputRef.modelValue || '0')
|
||||||
|
state.alt = parseFloat(altRef.value.inputRef.modelValue || '0')
|
||||||
|
|
||||||
state.timer = setInterval(()=>{
|
state.timer = setInterval(()=>{
|
||||||
state.dt = new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })
|
state.dt = new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })
|
||||||
|
localStorage.setItem('myLng', state.lng.toString());
|
||||||
|
localStorage.setItem('myLat', state.lat.toString());
|
||||||
|
localStorage.setItem('myAlt', state.alt.toString());
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue