Compare commits
4
Commits
dfc26aedea
...
79f3cffb5e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f3cffb5e | ||
|
|
5ad3f87323 | ||
|
|
5b5849744b | ||
|
|
44f3d57884 |
No files matched your search
@@ -37,3 +37,5 @@ miaoShare.db
|
||||
|
||||
# JWT SK
|
||||
*.key
|
||||
|
||||
visualizer.html
|
||||
+1
-3
@@ -26,8 +26,7 @@ import config from "../miaoShareConfig.json"
|
||||
|
||||
const settingData = useSettingStore();
|
||||
const serverPort = settingData.serverPort;
|
||||
const baseUrl =
|
||||
location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = settingData.baseUrl
|
||||
const tokenExpiresIn = config.tokenExpiresIn
|
||||
|
||||
|
||||
@@ -46,7 +45,6 @@ const menuOptions = ref([
|
||||
key: 'upload',
|
||||
icon: renderIcon(uploadIcon),
|
||||
disabled: computed(() => {
|
||||
// console.log(settingData)
|
||||
return settingData.token === null
|
||||
})
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ const _toClipboard = async (text) => {
|
||||
}
|
||||
const setting = useSettingStore();
|
||||
const serverPort = setting.serverPort;
|
||||
const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = setting.baseUrl
|
||||
const props = defineProps({
|
||||
messages: {
|
||||
type: Array,
|
||||
|
||||
+29
-18
@@ -1,18 +1,20 @@
|
||||
import { defineStore } from "pinia";
|
||||
import config from "../../miaoShareConfig.json"
|
||||
import { defineStore } from 'pinia'
|
||||
import config from '../../miaoShareConfig.json'
|
||||
|
||||
const userID = localStorage.getItem('userID');
|
||||
const userGroup = localStorage.getItem('userGroup');
|
||||
console.log(location)
|
||||
|
||||
const userID = localStorage.getItem('userID')
|
||||
const userGroup = localStorage.getItem('userGroup')
|
||||
|
||||
const tokenExpiresIn = config.tokenExpiresIn
|
||||
if(localStorage.getItem('tokenExpiredTime') == null ||
|
||||
parseInt(localStorage.getItem('tokenExpiredTime')) < parseInt(Date.now())){
|
||||
if (
|
||||
localStorage.getItem('tokenExpiredTime') == null ||
|
||||
parseInt(localStorage.getItem('tokenExpiredTime')) < parseInt(Date.now())
|
||||
) {
|
||||
localStorage.removeItem('token')
|
||||
}
|
||||
|
||||
const token = localStorage.getItem('token');
|
||||
|
||||
// console.log(token)
|
||||
const token = localStorage.getItem('token')
|
||||
|
||||
var activeFuctionLocal = localStorage.getItem('activeFuction')
|
||||
if (activeFuctionLocal == null) {
|
||||
@@ -28,10 +30,16 @@ if (activeKeyMap == null ){
|
||||
}
|
||||
|
||||
// 开发环境下服务器端口使用设置的端口,否则使用与页面相同的端口
|
||||
const serverPort = process.env.NODE_ENV === 'development' ? config.PORT : location.port
|
||||
const serverPort =
|
||||
process.env.NODE_ENV === 'development' ? config.PORT : location.port
|
||||
|
||||
const baseUrl =
|
||||
location.protocol + '//' + location.hostname + ':' + serverPort + '/'
|
||||
|
||||
const wsBaseUrl = 'ws' + '://' + location.hostname + ':' + serverPort
|
||||
|
||||
// console.log(process.env.NODE_ENV,config.DEVPORT,location.port,serverPort)
|
||||
export const useSettingStore = defineStore("setting", {
|
||||
export const useSettingStore = defineStore('setting', {
|
||||
state: () => ({
|
||||
activeFuction: activeFuctionLocal,
|
||||
activeKeyMap: JSON.parse(activeKeyMap),
|
||||
@@ -39,7 +47,9 @@ export const useSettingStore = defineStore("setting", {
|
||||
serverPort,
|
||||
token,
|
||||
userID,
|
||||
userGroup
|
||||
userGroup,
|
||||
baseUrl,
|
||||
wsBaseUrl
|
||||
}),
|
||||
getters: {
|
||||
// double: state => state.count * 2
|
||||
@@ -49,18 +59,19 @@ export const useSettingStore = defineStore("setting", {
|
||||
this.token = token
|
||||
if (keepTokenLocal) {
|
||||
localStorage.setItem('token', token)
|
||||
localStorage.setItem('tokenExpiredTime',parseInt(Date.now())+parseInt(tokenExpiresIn)*3600000)
|
||||
localStorage.setItem(
|
||||
'tokenExpiredTime',
|
||||
parseInt(Date.now()) + parseInt(tokenExpiresIn) * 3600000
|
||||
)
|
||||
}
|
||||
},
|
||||
setUserID(id, keepTokenLocal) {
|
||||
this.userID = id
|
||||
if(keepTokenLocal)
|
||||
localStorage.setItem('userID',id)
|
||||
if (keepTokenLocal) localStorage.setItem('userID', id)
|
||||
},
|
||||
setUserGroup(g, keepTokenLocal) {
|
||||
this.userGroup = g
|
||||
if(keepTokenLocal)
|
||||
localStorage.setItem('userGroup',g)
|
||||
if (keepTokenLocal) localStorage.setItem('userGroup', g)
|
||||
},
|
||||
getToken() {
|
||||
return localStorage.getItem('token')
|
||||
@@ -69,4 +80,4 @@ export const useSettingStore = defineStore("setting", {
|
||||
// this.count++;
|
||||
// }
|
||||
}
|
||||
});
|
||||
})
|
||||
+5
-3
@@ -105,9 +105,11 @@ const _toClipboard = async (text) => {
|
||||
|
||||
const setting = useSettingStore();
|
||||
const serverPort = setting.serverPort;
|
||||
const wsBaseUrl = 'ws' + "://" + location.hostname + ":" + serverPort;
|
||||
const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const QRIconUrl = ref(location.protocol + "//" + location.hostname + ":" + serverPort + "/favicon.ico")
|
||||
// const wsBaseUrl = 'ws' + "://" + location.hostname + ":" + serverPort;
|
||||
const wsBaseUrl = setting.wsBaseUrl
|
||||
// const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = setting.baseUrl
|
||||
const QRIconUrl = ref(baseUrl + "favicon.ico")
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
||||
@@ -40,8 +40,8 @@ const setting = useSettingStore();
|
||||
// 服务端端口
|
||||
const serverPort = setting.serverPort;
|
||||
|
||||
var baseUrl =
|
||||
location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
// const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = setting.baseUrl
|
||||
// console.log(baseUrl);
|
||||
|
||||
// const blob2Uint8Array = function(blob) {
|
||||
|
||||
+2
-2
@@ -43,8 +43,8 @@ const serverPort = settingData.serverPort;
|
||||
const userIDInput = ref('')
|
||||
const userPasswordInput = ref('')
|
||||
const isLogining = ref(false)
|
||||
const baseUrl =
|
||||
location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
// const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = settingData.baseUrl
|
||||
|
||||
const Token = computed(() => settingData.token)
|
||||
const keepTokenLocal = ref(true)
|
||||
|
||||
@@ -94,8 +94,9 @@ var file_Code_Map = ref([]);
|
||||
var uploadProcess = ref(0);
|
||||
|
||||
|
||||
const baseUrl =
|
||||
location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
// const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
|
||||
const baseUrl = setting.baseUrl
|
||||
console.log(baseUrl)
|
||||
|
||||
|
||||
// const blob2Uint8Array = function(blob) {
|
||||
|
||||
Reference in new issue
Block a user