mirror of
https://github.com/hi2shark/nazhua.git
synced 2026-01-20 11:19:36 +08:00
Compare commits
No commits in common. "842cc7d2f840bee557d0b9882b6dc3a51b767cd0" and "39fc6b2497067730b0dc0c9b0870fd02ccb4dd0f" have entirely different histories.
842cc7d2f8
...
39fc6b2497
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nazhua",
|
"name": "nazhua",
|
||||||
"version": "0.6.0",
|
"version": "0.5.8",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -15,8 +15,7 @@ window.$$nazhuaConfig = {
|
|||||||
// listServerStatusType: 'progress', // 服务器状态类型--列表
|
// listServerStatusType: 'progress', // 服务器状态类型--列表
|
||||||
// listServerRealTimeShowLoad: true, // 列表显示服务器实时负载
|
// listServerRealTimeShowLoad: true, // 列表显示服务器实时负载
|
||||||
// detailServerStatusType: 'progress', // 服务器状态类型--详情页
|
// detailServerStatusType: 'progress', // 服务器状态类型--详情页
|
||||||
// simpleColorMode: true, // 服务器状态纯色显示
|
serverStatusLinear: true, // 服务器状态渐变线性显示
|
||||||
serverStatusLinear: true, // 服务器状态渐变线性显示 - 与pureColorMode互斥
|
|
||||||
// disableSarasaTermSC: true, // 禁用Sarasa Term SC字体
|
// disableSarasaTermSC: true, // 禁用Sarasa Term SC字体
|
||||||
// hideWorldMap: false, // 隐藏地图
|
// hideWorldMap: false, // 隐藏地图
|
||||||
// hideHomeWorldMap: false, // 隐藏首页地图
|
// hideHomeWorldMap: false, // 隐藏首页地图
|
||||||
|
|||||||
@ -26,15 +26,8 @@
|
|||||||
--list-item-price-color: #eee;
|
--list-item-price-color: #eee;
|
||||||
--list-item-buy-link-color: #ffc300;
|
--list-item-buy-link-color: #ffc300;
|
||||||
--list-item-buy-link-color-hover: #ff9900;
|
--list-item-buy-link-color-hover: #ff9900;
|
||||||
--public-note-tag-color: #ccc;
|
--public-note-tag-color: #ddd;
|
||||||
--public-note-tag-bg: linear-gradient(125deg, #676ef7, #41459c);
|
--public-note-tag-bg: linear-gradient(125deg, #8f94fb, #4e54c8);
|
||||||
|
|
||||||
--option-high-color: #ff7500;
|
|
||||||
--option-high-color-active: rgba(255, 177, 0, 0.75);
|
|
||||||
|
|
||||||
--server-status-value-color: #a1eafb;
|
|
||||||
--server-status-label-color: #ddd;
|
|
||||||
--server-status-content-color: #eee;
|
|
||||||
|
|
||||||
// 针对1440px以下的屏幕
|
// 针对1440px以下的屏幕
|
||||||
@media screen and (max-width: 1440px) {
|
@media screen and (max-width: 1440px) {
|
||||||
@ -61,27 +54,3 @@
|
|||||||
--detail-container-width: 100vw;
|
--detail-container-width: 100vw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body.simple-color-mode {
|
|
||||||
|
|
||||||
--world-map-point-color: #cbf1f5;
|
|
||||||
|
|
||||||
--simple-color: #ccc;
|
|
||||||
--duration-color: var(--simple-color);
|
|
||||||
--transfer-color: var(--simple-color);
|
|
||||||
--transfer-in-color: var(--transfer-color);
|
|
||||||
--transfer-out-color: var(--simple-color);
|
|
||||||
--net-speed-in-color: var(--simple-color);
|
|
||||||
--net-speed-out-color: var(--simple-color);
|
|
||||||
|
|
||||||
--list-item-price-color: #eee;
|
|
||||||
--list-item-buy-link-color: var(--simple-color);
|
|
||||||
--list-item-buy-link-color-hover: draken(#cbf1f5, 10%);
|
|
||||||
--public-note-tag-color: #eee;
|
|
||||||
--public-note-tag-bg: transparent;
|
|
||||||
|
|
||||||
--option-high-color: rgb(93, 122, 126);
|
|
||||||
--option-high-color-active: rgba(93, 122, 126, 0.75);
|
|
||||||
|
|
||||||
--server-status-value-color: var(--simple-color);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -35,12 +35,7 @@ function handleColor(color) {
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (used, total, itemColors, size = 100) => {
|
export default (used, total, itemColors, size = 100) => ({
|
||||||
const isLinear = (
|
|
||||||
(config.nazhua.serverStatusLinear || config.nazhua.lightBackground)
|
|
||||||
&& !config.nazhua.simpleColorMode
|
|
||||||
);
|
|
||||||
return {
|
|
||||||
angleAxis: {
|
angleAxis: {
|
||||||
max: total, // 满分
|
max: total, // 满分
|
||||||
// 隐藏刻度线
|
// 隐藏刻度线
|
||||||
@ -94,7 +89,7 @@ export default (used, total, itemColors, size = 100) => {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
})(),
|
})(),
|
||||||
shadowBlur: isLinear ? 10 : undefined,
|
shadowBlur: (config.nazhua.serverStatusLinear || config.nazhua.lightBackground) ? 10 : undefined,
|
||||||
},
|
},
|
||||||
coordinateSystem: 'polar',
|
coordinateSystem: 'polar',
|
||||||
cursor: 'default',
|
cursor: 'default',
|
||||||
@ -116,5 +111,4 @@ export default (used, total, itemColors, size = 100) => {
|
|||||||
barGap: '-100%', // 两环重叠
|
barGap: '-100%', // 两环重叠
|
||||||
z: 5,
|
z: 5,
|
||||||
}],
|
}],
|
||||||
};
|
});
|
||||||
};
|
|
||||||
|
|||||||
@ -33,15 +33,6 @@ if (config.nazhua.nezhaVersion) {
|
|||||||
config.init = true;
|
config.init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setColorMode() {
|
|
||||||
if (config.nazhua.simpleColorMode) {
|
|
||||||
document.body.classList.add('simple-color-mode');
|
|
||||||
} else {
|
|
||||||
document.body.classList.remove('simple-color-mode');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setColorMode();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 替换网站图标
|
* 替换网站图标
|
||||||
*/
|
*/
|
||||||
@ -63,7 +54,6 @@ export function mergeNazhuaConfig(customConfig) {
|
|||||||
config.nazhua[key] = customConfig[key];
|
config.nazhua[key] = customConfig[key];
|
||||||
});
|
});
|
||||||
replaceFavicon();
|
replaceFavicon();
|
||||||
setColorMode();
|
|
||||||
}
|
}
|
||||||
// 暴露合并配置方法
|
// 暴露合并配置方法
|
||||||
window.$mergeNazhuaConfig = mergeNazhuaConfig;
|
window.$mergeNazhuaConfig = mergeNazhuaConfig;
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
class="server-option-box"
|
class="server-option-box"
|
||||||
:class="{
|
:class="{
|
||||||
'server-option-box--light-background': lightBackground,
|
'server-option-box--light-background': lightBackground,
|
||||||
'server-option-box--mobile-hide': !mobileShow,
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -53,10 +52,6 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
mobileShow: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emits = defineEmits([
|
const emits = defineEmits([
|
||||||
@ -90,12 +85,6 @@ function toggleModelValue(item) {
|
|||||||
padding: 0 var(--list-padding);
|
padding: 0 var(--list-padding);
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
&--mobile-hide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-option-item {
|
.server-option-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -133,13 +122,13 @@ function toggleModelValue(item) {
|
|||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
&:hover {
|
&:hover {
|
||||||
.option-label {
|
.option-label {
|
||||||
color: var(--option-high-color);
|
color: #ff7500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: var(--option-high-color-active);
|
background: rgba(#ff7500, 0.75);
|
||||||
|
|
||||||
.option-label {
|
.option-label {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -157,7 +146,7 @@ function toggleModelValue(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: var(--option-high-color-active);
|
background: rgba(#ff7500, 0.75);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,18 +114,18 @@ defineProps({
|
|||||||
.server-status-val-text {
|
.server-status-val-text {
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
font-size: var(--server-status-val-text-font-size, 14px);
|
font-size: var(--server-status-val-text-font-size, 14px);
|
||||||
color: var(--server-status-value-color);
|
color: #a1eafb;
|
||||||
}
|
}
|
||||||
.server-status-label {
|
.server-status-label {
|
||||||
line-height: 1.1em;
|
line-height: 1.1em;
|
||||||
font-size: var(--server-status-label-font-size, 12px);
|
font-size: var(--server-status-label-font-size, 12px);
|
||||||
color: var(--server-status-label-color);
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.server-status-content {
|
.server-status-content {
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
font-size: var(--server-status-content-font-size, 14px);
|
font-size: var(--server-status-content-font-size, 14px);
|
||||||
color: var(--server-status-content-color);
|
color: #eee;
|
||||||
|
|
||||||
.default-mobile {
|
.default-mobile {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@ -5,32 +5,6 @@ import config from '@/config';
|
|||||||
import validate from '@/utils/validate';
|
import validate from '@/utils/validate';
|
||||||
import * as hostUtils from '@/utils/host';
|
import * as hostUtils from '@/utils/host';
|
||||||
|
|
||||||
function getColor(type, mode) {
|
|
||||||
const colors = {
|
|
||||||
cpu: {
|
|
||||||
linear: ['#0088FF', '#72B7FF'],
|
|
||||||
default: '#0088FF',
|
|
||||||
simple: '#007B43',
|
|
||||||
},
|
|
||||||
mem: {
|
|
||||||
linear: ['#2B6939', '#0AA344'],
|
|
||||||
default: '#0AA344',
|
|
||||||
simple: '#007B43',
|
|
||||||
},
|
|
||||||
swap: {
|
|
||||||
linear: ['#FF8C00', '#F38100'],
|
|
||||||
default: '#FF8C00',
|
|
||||||
simple: '#007B43',
|
|
||||||
},
|
|
||||||
disk: {
|
|
||||||
linear: ['#00848F', '#70F3FF'],
|
|
||||||
default: '#70F3FF',
|
|
||||||
simple: '#007B43',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return colors[type][mode];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default (params) => {
|
export default (params) => {
|
||||||
const {
|
const {
|
||||||
props,
|
props,
|
||||||
@ -41,15 +15,7 @@ export default (params) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const lightBackground = computed(() => config.nazhua.lightBackground);
|
const lightBackground = computed(() => config.nazhua.lightBackground);
|
||||||
const serverStatusColorMode = computed(() => {
|
const serverStatusLinear = computed(() => config.nazhua.serverStatusLinear || lightBackground.value);
|
||||||
if (config.nazhua.simpleColorMode) {
|
|
||||||
return 'simple';
|
|
||||||
}
|
|
||||||
if (config.nazhua.serverStatusLinear || lightBackground.value) {
|
|
||||||
return 'linear';
|
|
||||||
}
|
|
||||||
return 'default';
|
|
||||||
});
|
|
||||||
|
|
||||||
const cpuInfo = computed(() => {
|
const cpuInfo = computed(() => {
|
||||||
if (props.info?.Host?.CPU?.[0]) {
|
if (props.info?.Host?.CPU?.[0]) {
|
||||||
@ -103,7 +69,7 @@ export default (params) => {
|
|||||||
case 'cpu':
|
case 'cpu':
|
||||||
{
|
{
|
||||||
const CoresVal = cpuInfo.value?.cores ? `${cpuInfo.value?.cores}C` : '-';
|
const CoresVal = cpuInfo.value?.cores ? `${cpuInfo.value?.cores}C` : '-';
|
||||||
const usedColor = getColor('cpu', serverStatusColorMode.value);
|
const usedColor = serverStatusLinear.value ? ['#0088FF', '#72B7FF'] : '#0088FF';
|
||||||
const valPercent = `${(props.info.State?.CPU || 0).toFixed(1) * 1}%`;
|
const valPercent = `${(props.info.State?.CPU || 0).toFixed(1) * 1}%`;
|
||||||
const valText = valPercent;
|
const valText = valPercent;
|
||||||
return {
|
return {
|
||||||
@ -136,7 +102,7 @@ export default (params) => {
|
|||||||
} else {
|
} else {
|
||||||
contentVal = `${Math.ceil(useMemAndTotalMem.value.total.m)}M`;
|
contentVal = `${Math.ceil(useMemAndTotalMem.value.total.m)}M`;
|
||||||
}
|
}
|
||||||
const usedColor = getColor('mem', serverStatusColorMode.value);
|
const usedColor = serverStatusLinear.value ? ['#2B6939', '#0AA344'] : '#0AA344';
|
||||||
return {
|
return {
|
||||||
type: 'mem',
|
type: 'mem',
|
||||||
used: useMemAndTotalMem.value.usePercent,
|
used: useMemAndTotalMem.value.usePercent,
|
||||||
@ -170,7 +136,7 @@ export default (params) => {
|
|||||||
} else {
|
} else {
|
||||||
contentVal = `${Math.ceil(useSwapAndTotalSwap.value.total.m)}M`;
|
contentVal = `${Math.ceil(useSwapAndTotalSwap.value.total.m)}M`;
|
||||||
}
|
}
|
||||||
const usedColor = getColor('swap', serverStatusColorMode.value);
|
const usedColor = serverStatusLinear.value ? ['#FF8C00', '#F38100'] : '#FF8C00';
|
||||||
return {
|
return {
|
||||||
type: 'swap',
|
type: 'swap',
|
||||||
used: useSwapAndTotalSwap.value.usePercent,
|
used: useSwapAndTotalSwap.value.usePercent,
|
||||||
@ -201,7 +167,7 @@ export default (params) => {
|
|||||||
} else {
|
} else {
|
||||||
contentValue = `${Math.ceil(useDiskAndTotalDisk.value.total.g)}G`;
|
contentValue = `${Math.ceil(useDiskAndTotalDisk.value.total.g)}G`;
|
||||||
}
|
}
|
||||||
const usedColor = getColor('disk', serverStatusColorMode.value);
|
const usedColor = serverStatusLinear.value ? ['#00848F', '#70F3FF'] : '#70F3FF';
|
||||||
return {
|
return {
|
||||||
type: 'disk',
|
type: 'disk',
|
||||||
used: useDiskAndTotalDisk.value.usePercent,
|
used: useDiskAndTotalDisk.value.usePercent,
|
||||||
|
|||||||
@ -36,7 +36,6 @@
|
|||||||
v-model="listType"
|
v-model="listType"
|
||||||
:options="listTypeOptions"
|
:options="listTypeOptions"
|
||||||
:accpet-empty="false"
|
:accpet-empty="false"
|
||||||
:mobile-show="false"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -111,10 +110,6 @@ const showTransition = computed(() => {
|
|||||||
if (config.nazhua.forceTransition) {
|
if (config.nazhua.forceTransition) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 安卓设备不开启 -> 部分安卓浏览器渲染动画会卡顿
|
|
||||||
if (window.navigator.userAgent.includes('Android')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 服务器数量小于7时,不开启
|
// 服务器数量小于7时,不开启
|
||||||
return store.state.serverList.length < 7;
|
return store.state.serverList.length < 7;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user