mirror of
https://github.com/unraid/api.git
synced 2026-01-06 08:39:54 -06:00
Compare commits
5 Commits
v4.18.2
...
feat/serve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
533927c692 | ||
|
|
985ed5bad4 | ||
|
|
21123f39a6 | ||
|
|
fd6f4eccf4 | ||
|
|
2ce62bf789 |
@@ -47,6 +47,7 @@ class ServerState
|
|||||||
private $connectPluginVersion;
|
private $connectPluginVersion;
|
||||||
private $configErrorEnum = [
|
private $configErrorEnum = [
|
||||||
"error" => 'UNKNOWN_ERROR',
|
"error" => 'UNKNOWN_ERROR',
|
||||||
|
"ineligible" => 'INELIGIBLE',
|
||||||
"invalid" => 'INVALID',
|
"invalid" => 'INVALID',
|
||||||
"nokeyserver" => 'NO_KEY_SERVER',
|
"nokeyserver" => 'NO_KEY_SERVER',
|
||||||
"withdrawn" => 'WITHDRAWN',
|
"withdrawn" => 'WITHDRAWN',
|
||||||
@@ -241,7 +242,7 @@ class ServerState
|
|||||||
"caseModel" => $this->caseModel,
|
"caseModel" => $this->caseModel,
|
||||||
"config" => [
|
"config" => [
|
||||||
'valid' => ($this->var['configValid'] === 'yes'),
|
'valid' => ($this->var['configValid'] === 'yes'),
|
||||||
'error' => isset($this->configErrorEnum[$this->var['configValid']]) ? $this->configErrorEnum[$this->var['configValid']] : 'UNKNOWN_ERROR',
|
'error' => isset($this->configErrorEnum[$this->var['configValid']]) ? $this->configErrorEnum[$this->var['configValid']] : null,
|
||||||
],
|
],
|
||||||
"connectPluginInstalled" => $this->connectPluginInstalled,
|
"connectPluginInstalled" => $this->connectPluginInstalled,
|
||||||
"connectPluginVersion" => $this->connectPluginVersion,
|
"connectPluginVersion" => $this->connectPluginVersion,
|
||||||
|
|||||||
@@ -24,8 +24,32 @@ import type {
|
|||||||
// return result;
|
// return result;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// ENOKEYFILE
|
||||||
|
// TRIAL
|
||||||
|
// BASIC
|
||||||
|
// PLUS
|
||||||
|
// PRO
|
||||||
|
// STARTER
|
||||||
|
// UNLEASHED
|
||||||
|
// LIFETIME
|
||||||
|
// EEXPIRED
|
||||||
|
// EGUID
|
||||||
|
// EGUID1
|
||||||
|
// ETRIAL
|
||||||
|
// ENOKEYFILE2
|
||||||
|
// ENOKEYFILE1
|
||||||
|
// ENOFLASH
|
||||||
|
// EBLACKLISTED
|
||||||
|
// EBLACKLISTED1
|
||||||
|
// EBLACKLISTED2
|
||||||
|
// ENOCONN
|
||||||
|
|
||||||
// '1111-1111-5GDB-123412341234' Starter.key = TkJCrVyXMLWWGKZF6TCEvf0C86UYI9KfUDSOm7JoFP19tOMTMgLKcJ6QIOt9_9Psg_t0yF-ANmzSgZzCo94ljXoPm4BESFByR0K7nyY9KVvU8szLEUcBUT3xC2adxLrAXFNxiPeK-mZqt34n16uETKYvLKL_Sr5_JziG5L5lJFBqYZCPmfLMiguFo1vp0xL8pnBH7q8bYoBnePrAcAVb9mAGxFVPEInSPkMBfC67JLHz7XY1Y_K5bYIq3go9XPtLltJ53_U4BQiMHooXUBJCKXodpqoGxq0eV0IhNEYdauAhnTsG90qmGZig0hZalQ0soouc4JZEMiYEcZbn9mBxPg
|
// '1111-1111-5GDB-123412341234' Starter.key = TkJCrVyXMLWWGKZF6TCEvf0C86UYI9KfUDSOm7JoFP19tOMTMgLKcJ6QIOt9_9Psg_t0yF-ANmzSgZzCo94ljXoPm4BESFByR0K7nyY9KVvU8szLEUcBUT3xC2adxLrAXFNxiPeK-mZqt34n16uETKYvLKL_Sr5_JziG5L5lJFBqYZCPmfLMiguFo1vp0xL8pnBH7q8bYoBnePrAcAVb9mAGxFVPEInSPkMBfC67JLHz7XY1Y_K5bYIq3go9XPtLltJ53_U4BQiMHooXUBJCKXodpqoGxq0eV0IhNEYdauAhnTsG90qmGZig0hZalQ0soouc4JZEMiYEcZbn9mBxPg
|
||||||
const staticGuid = '1111-1111-5GDB-123412341234';
|
|
||||||
|
const state: ServerState = 'STARTER';
|
||||||
|
const currentFlashGuid = '1111-1111-SDDD-TEST1234ZACK '; // this is the flash drive that's been booted from
|
||||||
|
const regGuid = '1111-1111-SDDD-TEST1234ZACK '; // this guid is registered in key server
|
||||||
|
const keyfileBase64 = ''; // @todo raycast download key to base64
|
||||||
|
|
||||||
// const randomGuid = `1111-1111-${makeid(4)}-123412341234`; // this guid is registered in key server
|
// const randomGuid = `1111-1111-${makeid(4)}-123412341234`; // this guid is registered in key server
|
||||||
// const newGuid = `1234-1234-${makeid(4)}-123412341234`; // this is a new USB, not registered
|
// const newGuid = `1234-1234-${makeid(4)}-123412341234`; // this is a new USB, not registered
|
||||||
@@ -42,23 +66,6 @@ const oneHourFromNow = Date.now() + 60 * 60 * 1000; // 1 hour from now
|
|||||||
let expireTime = 0;
|
let expireTime = 0;
|
||||||
let regExp: number | undefined;
|
let regExp: number | undefined;
|
||||||
|
|
||||||
// ENOKEYFILE
|
|
||||||
// TRIAL
|
|
||||||
// BASIC
|
|
||||||
// PLUS
|
|
||||||
// PRO
|
|
||||||
// EEXPIRED
|
|
||||||
// EGUID
|
|
||||||
// EGUID1
|
|
||||||
// ETRIAL
|
|
||||||
// ENOKEYFILE2
|
|
||||||
// ENOKEYFILE1
|
|
||||||
// ENOFLASH
|
|
||||||
// EBLACKLISTED
|
|
||||||
// EBLACKLISTED1
|
|
||||||
// EBLACKLISTED2
|
|
||||||
// ENOCONN
|
|
||||||
const state: ServerState = 'TRIAL';
|
|
||||||
let regDevs = 0;
|
let regDevs = 0;
|
||||||
let regTy = '';
|
let regTy = '';
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -101,10 +108,10 @@ switch (state) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const connectPluginInstalled = 'dynamix.unraid.net.staging.plg';
|
// const connectPluginInstalled = 'dynamix.unraid.net.staging.plg';
|
||||||
// const connectPluginInstalled = '';
|
const connectPluginInstalled = '';
|
||||||
|
|
||||||
const osVersion = '6.12.5';
|
const osVersion = '6.12.8';
|
||||||
const osVersionBranch = 'stable';
|
const osVersionBranch = 'stable';
|
||||||
// const parsedRegExp = regExp ? dayjs(regExp).format('YYYY-MM-DD') : undefined;
|
// const parsedRegExp = regExp ? dayjs(regExp).format('YYYY-MM-DD') : undefined;
|
||||||
|
|
||||||
@@ -133,21 +140,21 @@ export const serverState: Server = {
|
|||||||
apiKey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
|
apiKey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
|
||||||
avatar: 'https://source.unsplash.com/300x300/?portrait',
|
avatar: 'https://source.unsplash.com/300x300/?portrait',
|
||||||
config: {
|
config: {
|
||||||
// error: 'INVALID',
|
error: null,
|
||||||
valid: true,
|
valid: false,
|
||||||
},
|
},
|
||||||
connectPluginInstalled,
|
connectPluginInstalled,
|
||||||
description: 'DevServer9000',
|
description: 'DevServer9000',
|
||||||
deviceCount: 3,
|
deviceCount: 4,
|
||||||
expireTime,
|
expireTime,
|
||||||
flashBackupActivated: !!connectPluginInstalled,
|
flashBackupActivated: !!connectPluginInstalled,
|
||||||
flashProduct: 'SanDisk_3.2Gen1',
|
flashProduct: 'SanDisk_3.2Gen1',
|
||||||
flashVendor: 'USB',
|
flashVendor: 'USB',
|
||||||
guid: staticGuid,
|
guid: currentFlashGuid,
|
||||||
// "guid": "0781-5583-8355-81071A2B0211",
|
// "guid": "0781-5583-8355-81071A2B0211",
|
||||||
inIframe: false,
|
inIframe: false,
|
||||||
// keyfile: 'DUMMY_KEYFILE',
|
// keyfile: 'DUMMY_KEYFILE',
|
||||||
keyfile: 'TkJCrVyXMLWWGKZF6TCEvf0C86UYI9KfUDSOm7JoFP19tOMTMgLKcJ6QIOt9_9Psg_t0yF-ANmzSgZzCo94ljXoPm4BESFByR0K7nyY9KVvU8szLEUcBUT3xC2adxLrAXFNxiPeK-mZqt34n16uETKYvLKL_Sr5_JziG5L5lJFBqYZCPmfLMiguFo1vp0xL8pnBH7q8bYoBnePrAcAVb9mAGxFVPEInSPkMBfC67JLHz7XY1Y_K5bYIq3go9XPtLltJ53_U4BQiMHooXUBJCKXodpqoGxq0eV0IhNEYdauAhnTsG90qmGZig0hZalQ0soouc4JZEMiYEcZbn9mBxPg',
|
keyfile: keyfileBase64,
|
||||||
lanIp: '192.168.254.36',
|
lanIp: '192.168.254.36',
|
||||||
license: '',
|
license: '',
|
||||||
locale: 'en_US', // en_US, ja
|
locale: 'en_US', // en_US, ja
|
||||||
@@ -161,7 +168,7 @@ export const serverState: Server = {
|
|||||||
regTo: 'Zack Spear',
|
regTo: 'Zack Spear',
|
||||||
regTy,
|
regTy,
|
||||||
regExp,
|
regExp,
|
||||||
// "regGuid": "0781-5583-8355-81071A2B0211",
|
regGuid,
|
||||||
site: 'http://localhost:4321',
|
site: 'http://localhost:4321',
|
||||||
state,
|
state,
|
||||||
theme: {
|
theme: {
|
||||||
@@ -173,15 +180,15 @@ export const serverState: Server = {
|
|||||||
name: 'white',
|
name: 'white',
|
||||||
textColor: ''
|
textColor: ''
|
||||||
},
|
},
|
||||||
updateOsResponse: {
|
// updateOsResponse: {
|
||||||
version: '6.12.6',
|
// version: '6.12.6',
|
||||||
name: 'Unraid 6.12.6',
|
// name: 'Unraid 6.12.6',
|
||||||
date: '2023-12-13',
|
// date: '2023-12-13',
|
||||||
isNewer: true,
|
// isNewer: true,
|
||||||
isEligible: false,
|
// isEligible: false,
|
||||||
changelog: 'https://docs.unraid.net/unraid-os/release-notes/6.12.6/',
|
// changelog: 'https://docs.unraid.net/unraid-os/release-notes/6.12.6/',
|
||||||
sha256: '2f5debaf80549029cf6dfab0db59180e7e3391c059e6521aace7971419c9c4bf',
|
// sha256: '2f5debaf80549029cf6dfab0db59180e7e3391c059e6521aace7971419c9c4bf',
|
||||||
},
|
// },
|
||||||
uptime,
|
uptime,
|
||||||
username: 'zspearmint',
|
username: 'zspearmint',
|
||||||
wanFQDN: ''
|
wanFQDN: ''
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ const items = computed((): RegistrationItemProps[] => {
|
|||||||
: []),
|
: []),
|
||||||
...(keyInstalled.value
|
...(keyInstalled.value
|
||||||
? [{
|
? [{
|
||||||
error: !!tooManyDevices.value,
|
error: tooManyDevices.value,
|
||||||
label: t('Attached Storage Devices'),
|
label: t('Attached Storage Devices'),
|
||||||
text: tooManyDevices.value
|
text: tooManyDevices.value
|
||||||
? t('{0} out of {1} allowed devices – upgrade your key to support more devices', [deviceCount.value, computedRegDevs.value])
|
? t('{0} out of {1} allowed devices – upgrade your key to support more devices', [deviceCount.value, computedRegDevs.value])
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ export type Config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export enum ConfigErrorState {
|
export enum ConfigErrorState {
|
||||||
|
Ineligible = 'INELIGIBLE',
|
||||||
Invalid = 'INVALID',
|
Invalid = 'INVALID',
|
||||||
NoKeyServer = 'NO_KEY_SERVER',
|
NoKeyServer = 'NO_KEY_SERVER',
|
||||||
UnknownError = 'UNKNOWN_ERROR',
|
UnknownError = 'UNKNOWN_ERROR',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import dayjs from 'dayjs';
|
|||||||
import { defineStore, createPinia, setActivePinia } from 'pinia';
|
import { defineStore, createPinia, setActivePinia } from 'pinia';
|
||||||
import prerelease from 'semver/functions/prerelease';
|
import prerelease from 'semver/functions/prerelease';
|
||||||
import {
|
import {
|
||||||
|
ArrowPathIcon,
|
||||||
ArrowRightOnRectangleIcon,
|
ArrowRightOnRectangleIcon,
|
||||||
CogIcon,
|
CogIcon,
|
||||||
GlobeAltIcon,
|
GlobeAltIcon,
|
||||||
@@ -17,7 +18,11 @@ import { useQuery } from '@vue/apollo-composable';
|
|||||||
import { SERVER_CLOUD_FRAGMENT, SERVER_STATE_QUERY } from './server.fragment';
|
import { SERVER_CLOUD_FRAGMENT, SERVER_STATE_QUERY } from './server.fragment';
|
||||||
import { useFragment } from '~/composables/gql/fragment-masking';
|
import { useFragment } from '~/composables/gql/fragment-masking';
|
||||||
import { WebguiState, WebguiUpdateIgnore } from '~/composables/services/webgui';
|
import { WebguiState, WebguiUpdateIgnore } from '~/composables/services/webgui';
|
||||||
import { WEBGUI_SETTINGS_MANAGMENT_ACCESS } from '~/helpers/urls';
|
import {
|
||||||
|
WEBGUI_SETTINGS_MANAGMENT_ACCESS,
|
||||||
|
WEBGUI_TOOLS_REGISTRATION,
|
||||||
|
WEBGUI_TOOLS_UPDATE,
|
||||||
|
} from '~/helpers/urls';
|
||||||
import { useAccountStore } from '~/store/account';
|
import { useAccountStore } from '~/store/account';
|
||||||
import { useErrorsStore, type Error } from '~/store/errors';
|
import { useErrorsStore, type Error } from '~/store/errors';
|
||||||
import { usePurchaseStore } from '~/store/purchase';
|
import { usePurchaseStore } from '~/store/purchase';
|
||||||
@@ -683,24 +688,73 @@ export const useServerStore = defineStore('server', () => {
|
|||||||
});
|
});
|
||||||
const trialExtensionEligible = computed(() => !regGen.value || regGen.value < 2);
|
const trialExtensionEligible = computed(() => !regGen.value || regGen.value < 2);
|
||||||
|
|
||||||
const tooManyDevices = computed((): Error | undefined => {
|
const serverConfigError = computed((): Error | undefined => {
|
||||||
if ((deviceCount.value !== 0 && computedRegDevs.value > 0 && deviceCount.value > computedRegDevs.value) ||
|
if (!config.value?.valid && config.value?.error) {
|
||||||
(!config.value?.valid && config.value?.error === 'INVALID')) {
|
switch (config.value?.error) {
|
||||||
return {
|
// case 'UNKNOWN_ERROR':
|
||||||
heading: 'Too Many Devices',
|
// return {
|
||||||
level: 'error',
|
// heading: 'Unknown Error',
|
||||||
message: 'You have exceeded the number of devices allowed for your license. Please remove a device before adding another.',
|
// level: 'error',
|
||||||
ref: 'tooManyDevices',
|
// message: 'An unknown internal error occurred.',
|
||||||
type: 'server',
|
// ref: 'configError',
|
||||||
};
|
// type: 'server',
|
||||||
|
// };
|
||||||
|
case 'INELIGIBLE':
|
||||||
|
return {
|
||||||
|
heading: 'Ineligible for OS Version',
|
||||||
|
level: 'error',
|
||||||
|
message: 'Your License Key does not support this OS Version. OS build date greater than key expiration.',
|
||||||
|
actions: [{
|
||||||
|
href: WEBGUI_TOOLS_REGISTRATION.toString(),
|
||||||
|
icon: CogIcon,
|
||||||
|
text: 'Learn More at Tools > Registration',
|
||||||
|
}],
|
||||||
|
ref: 'configError',
|
||||||
|
type: 'server',
|
||||||
|
};
|
||||||
|
case 'INVALID':
|
||||||
|
return {
|
||||||
|
heading: 'Too Many Devices',
|
||||||
|
level: 'error',
|
||||||
|
message: 'You have exceeded the number of devices allowed for your license. Please remove a device before starting the array or upgrade your key to support more devices.',
|
||||||
|
ref: 'configError',
|
||||||
|
type: 'server',
|
||||||
|
};
|
||||||
|
case 'NO_KEY_SERVER':
|
||||||
|
return {
|
||||||
|
heading: 'Check Network Connection',
|
||||||
|
level: 'error',
|
||||||
|
message: 'Unable to validate your trial key. Please check your network connection.',
|
||||||
|
ref: 'configError',
|
||||||
|
type: 'server',
|
||||||
|
};
|
||||||
|
case 'WITHDRAWN':
|
||||||
|
return {
|
||||||
|
heading: 'OS Version Withdrawn',
|
||||||
|
level: 'error',
|
||||||
|
message: 'This OS release should not be run. OS Update Required.',
|
||||||
|
actions: [{
|
||||||
|
href: WEBGUI_TOOLS_UPDATE.toString(),
|
||||||
|
icon: ArrowPathIcon,
|
||||||
|
text: 'Check for Update',
|
||||||
|
}],
|
||||||
|
ref: 'configError',
|
||||||
|
type: 'server',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
});
|
});
|
||||||
watch(tooManyDevices, (newVal, oldVal) => {
|
watch(serverConfigError, (newVal, oldVal) => {
|
||||||
if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); }
|
if (oldVal && oldVal.ref) { errorsStore.removeErrorByRef(oldVal.ref); }
|
||||||
if (newVal) { errorsStore.setError(newVal); }
|
if (newVal) { errorsStore.setError(newVal); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tooManyDevices = computed((): boolean => {
|
||||||
|
return ((deviceCount.value !== 0 && computedRegDevs.value > 0 && deviceCount.value > computedRegDevs.value) ||
|
||||||
|
(!config.value?.valid && config.value?.error === 'INVALID'));
|
||||||
|
});
|
||||||
|
|
||||||
const pluginInstallFailed = computed((): Error | undefined => {
|
const pluginInstallFailed = computed((): Error | undefined => {
|
||||||
if (connectPluginInstalled.value && connectPluginInstalled.value.includes('_installFailed')) {
|
if (connectPluginInstalled.value && connectPluginInstalled.value.includes('_installFailed')) {
|
||||||
return {
|
return {
|
||||||
@@ -797,7 +851,7 @@ export const useServerStore = defineStore('server', () => {
|
|||||||
const serverErrors = computed(() => {
|
const serverErrors = computed(() => {
|
||||||
return [
|
return [
|
||||||
stateDataError.value,
|
stateDataError.value,
|
||||||
tooManyDevices.value,
|
serverConfigError.value,
|
||||||
pluginInstallFailed.value,
|
pluginInstallFailed.value,
|
||||||
deprecatedUnraidSSL.value,
|
deprecatedUnraidSSL.value,
|
||||||
cloudError.value,
|
cloudError.value,
|
||||||
@@ -1077,6 +1131,7 @@ export const useServerStore = defineStore('server', () => {
|
|||||||
stateDataError,
|
stateDataError,
|
||||||
serverErrors,
|
serverErrors,
|
||||||
tooManyDevices,
|
tooManyDevices,
|
||||||
|
serverConfigError,
|
||||||
// actions
|
// actions
|
||||||
setServer,
|
setServer,
|
||||||
setUpdateOsResponse,
|
setUpdateOsResponse,
|
||||||
|
|||||||
Reference in New Issue
Block a user