mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 07:27:33 +08:00
code refactor
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<img style="display: none;" :src="devCookiePath" v-if="!isProduction" />
|
||||
<v-app>
|
||||
<router-view />
|
||||
</v-app>
|
||||
@@ -35,8 +34,6 @@ import { getSystemTheme, setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isProduction: isProduction(),
|
||||
devCookiePath: isProduction() ? '' : '/dev/cookies',
|
||||
showNotification: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<img style="display: none;" :src="devCookiePath" v-if="!isProduction" />
|
||||
<f7-app v-bind="f7params">
|
||||
<f7-view id="main-view" class="safe-areas" main url="/"></f7-view>
|
||||
</f7-app>
|
||||
@@ -35,8 +34,6 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
isProduction: isProduction(),
|
||||
devCookiePath: isProduction() ? '' : '/dev/cookies',
|
||||
notification: null,
|
||||
f7params: {
|
||||
name: 'ezBookkeeping',
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png">
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/8.3__iPad_Mini_portrait.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<script src="./server_settings.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png">
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/8.3__iPad_Mini_portrait.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<script src="./server_settings.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
||||
+21
-45
@@ -1,60 +1,36 @@
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
import { base64decode } from './common.js';
|
||||
|
||||
const serverSettingsCookieKey = 'ebk_server_settings';
|
||||
const serverSettingsGlobalVariableName = 'EZBOOKKEEPING_SERVER_SETTINGS';
|
||||
|
||||
function getServerSetting(key) {
|
||||
const settings = Cookies.get(serverSettingsCookieKey) || '';
|
||||
const settingsArr = settings.split('_');
|
||||
|
||||
for (let i = 0; i < settingsArr.length; i++) {
|
||||
const pairs = settingsArr[i].split('.');
|
||||
|
||||
if (pairs[0] === key) {
|
||||
return pairs[1];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getServerDecodedSetting(key) {
|
||||
const value = getServerSetting(key);
|
||||
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return decodeURIComponent(base64decode(value));
|
||||
const settings = window[serverSettingsGlobalVariableName] || {};
|
||||
return settings[key];
|
||||
}
|
||||
|
||||
export function isUserRegistrationEnabled() {
|
||||
return getServerSetting('r') === '1';
|
||||
return getServerSetting('r') === 1;
|
||||
}
|
||||
|
||||
export function isUserForgetPasswordEnabled() {
|
||||
return getServerSetting('f') === '1';
|
||||
return getServerSetting('f') === 1;
|
||||
}
|
||||
|
||||
export function isUserVerifyEmailEnabled() {
|
||||
return getServerSetting('v') === '1';
|
||||
return getServerSetting('v') === 1;
|
||||
}
|
||||
|
||||
export function isTransactionPicturesEnabled() {
|
||||
return getServerSetting('p') === '1';
|
||||
return getServerSetting('p') === 1;
|
||||
}
|
||||
|
||||
export function isUserScheduledTransactionEnabled() {
|
||||
return getServerSetting('s') === '1';
|
||||
return getServerSetting('s') === 1;
|
||||
}
|
||||
|
||||
export function isDataExportingEnabled() {
|
||||
return getServerSetting('e') === '1';
|
||||
return getServerSetting('e') === 1;
|
||||
}
|
||||
|
||||
export function isDataImportingEnabled() {
|
||||
return getServerSetting('i') === '1';
|
||||
return getServerSetting('i') === 1;
|
||||
}
|
||||
|
||||
export function getMapProvider() {
|
||||
@@ -62,19 +38,19 @@ export function getMapProvider() {
|
||||
}
|
||||
|
||||
export function isMapDataFetchProxyEnabled() {
|
||||
return getServerSetting('mp') === '1';
|
||||
return getServerSetting('mp') === 1;
|
||||
}
|
||||
|
||||
export function getCustomMapTileLayerUrl() {
|
||||
return getServerDecodedSetting('cmsu');
|
||||
return getServerSetting('cmsu');
|
||||
}
|
||||
|
||||
export function getCustomMapAnnotationLayerUrl() {
|
||||
return getServerDecodedSetting('cmau');
|
||||
return getServerSetting('cmau');
|
||||
}
|
||||
|
||||
export function isCustomMapAnnotationLayerDataFetchProxyEnabled() {
|
||||
return getServerSetting('cmap') === '1';
|
||||
return getServerSetting('cmap') === 1;
|
||||
}
|
||||
|
||||
export function getCustomMapMinZoomLevel() {
|
||||
@@ -93,23 +69,23 @@ export function getCustomMapDefaultZoomLevel() {
|
||||
}
|
||||
|
||||
export function getTomTomMapAPIKey() {
|
||||
return getServerDecodedSetting('tmak');
|
||||
return getServerSetting('tmak');
|
||||
}
|
||||
|
||||
export function getTianDiTuMapAPIKey() {
|
||||
return getServerDecodedSetting('tdak');
|
||||
return getServerSetting('tdak');
|
||||
}
|
||||
|
||||
export function getGoogleMapAPIKey() {
|
||||
return getServerDecodedSetting('gmak');
|
||||
return getServerSetting('gmak');
|
||||
}
|
||||
|
||||
export function getBaiduMapAK() {
|
||||
return getServerDecodedSetting('bmak');
|
||||
return getServerSetting('bmak');
|
||||
}
|
||||
|
||||
export function getAmapApplicationKey() {
|
||||
return getServerDecodedSetting('amak');
|
||||
return getServerSetting('amak');
|
||||
}
|
||||
|
||||
export function getAmapSecurityVerificationMethod() {
|
||||
@@ -117,9 +93,9 @@ export function getAmapSecurityVerificationMethod() {
|
||||
}
|
||||
|
||||
export function getAmapApiExternalProxyUrl() {
|
||||
return getServerDecodedSetting('amep');
|
||||
return getServerSetting('amep');
|
||||
}
|
||||
|
||||
export function getAmapApplicationSecret() {
|
||||
return getServerDecodedSetting('amas');
|
||||
return getServerSetting('amas');
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png">
|
||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)" href="img/splash_screens/8.3__iPad_Mini_portrait.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<script src="./server_settings.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
||||
Reference in New Issue
Block a user