mirror of
https://github.com/unraid/api.git
synced 2026-01-03 23:19:54 -06:00
Compare commits
1 Commits
v4.26.2
...
refactor/s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5972a15f48 |
@@ -1,20 +1,20 @@
|
|||||||
// import dayjs, { extend } from 'dayjs';
|
import dayjs, { extend } from 'dayjs';
|
||||||
// import customParseFormat from 'dayjs/plugin/customParseFormat';
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||||
// import relativeTime from 'dayjs/plugin/relativeTime';
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
// import wretch from 'wretch';
|
import wretch from 'wretch';
|
||||||
// // eslint-disable-next-line import/no-named-as-default
|
// // eslint-disable-next-line import/no-named-as-default
|
||||||
// import QueryStringAddon from 'wretch/addons/queryString';
|
import QueryStringAddon from 'wretch/addons/queryString';
|
||||||
|
|
||||||
// import { OS_RELEASES } from '~/helpers/urls';
|
import { OS_RELEASES } from '~/helpers/urls';
|
||||||
import type {
|
import type {
|
||||||
Server,
|
Server,
|
||||||
ServerState,
|
ServerState,
|
||||||
// ServerUpdateOsResponse,
|
ServerUpdateOsResponse,
|
||||||
} from '~/types/server';
|
} from '~/types/server';
|
||||||
|
|
||||||
// dayjs plugins
|
// dayjs plugins
|
||||||
// extend(customParseFormat);
|
extend(customParseFormat);
|
||||||
// extend(relativeTime);
|
extend(relativeTime);
|
||||||
|
|
||||||
// function makeid(length: number) {
|
// function makeid(length: number) {
|
||||||
// const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
// const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
||||||
@@ -105,80 +105,80 @@ const connectPluginInstalled = 'dynamix.unraid.net.staging.plg';
|
|||||||
|
|
||||||
const osVersion = '6.13.0-beta0.22';
|
const osVersion = '6.13.0-beta0.22';
|
||||||
const osVersionBranch = 'preview';
|
const osVersionBranch = 'preview';
|
||||||
// const parsedRegExp = regExp ? dayjs(regExp).format('YYYY-MM-DD') : undefined;
|
const parsedRegExp = regExp ? dayjs(regExp).format('YYYY-MM-DD') : undefined;
|
||||||
|
|
||||||
// const mimicWebguiUnraidCheck = async (): Promise<ServerUpdateOsResponse | undefined> => {
|
const mimicWebguiUnraidCheck = async (): Promise<ServerUpdateOsResponse | undefined> => {
|
||||||
// try {
|
try {
|
||||||
// const response = await wretch()
|
const response = await wretch()
|
||||||
// .addon(QueryStringAddon)
|
.addon(QueryStringAddon)
|
||||||
// .url(OS_RELEASES.toString())
|
.url(OS_RELEASES.toString())
|
||||||
// .query({
|
.query({
|
||||||
// ...(parsedRegExp ? { update_exp: parsedRegExp } : undefined),
|
...(parsedRegExp ? { update_exp: parsedRegExp } : undefined),
|
||||||
// ...(osVersion ? { current_version: osVersion } : undefined),
|
...(osVersion ? { current_version: osVersion } : undefined),
|
||||||
// ...(osVersionBranch ? { branch: osVersionBranch } : undefined),
|
...(osVersionBranch ? { branch: osVersionBranch } : undefined),
|
||||||
// })
|
})
|
||||||
// .get()
|
.get()
|
||||||
// .json<ServerUpdateOsResponse>()
|
.json<ServerUpdateOsResponse>()
|
||||||
// .catch((caughtError) => {
|
.catch((caughtError) => {
|
||||||
// throw new Error(caughtError);
|
throw new Error(caughtError);
|
||||||
// });
|
});
|
||||||
// return response;
|
return response;
|
||||||
// } catch {
|
} catch {
|
||||||
// return undefined;
|
return undefined;
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
export const serverState: Server = {
|
export const getServerState = async (): Promise<Server> => {
|
||||||
apiKey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
|
console.debug('[getServerState]');
|
||||||
avatar: 'https://source.unsplash.com/300x300/?portrait',
|
const serverState: Server = {
|
||||||
config: {
|
apiKey: 'unupc_fab6ff6ffe51040595c6d9ffb63a353ba16cc2ad7d93f813a2e80a5810',
|
||||||
// error: 'INVALID',
|
avatar: 'https://source.unsplash.com/300x300/?portrait',
|
||||||
valid: true,
|
config: {
|
||||||
},
|
// error: 'INVALID',
|
||||||
connectPluginInstalled,
|
valid: true,
|
||||||
description: 'DevServer9000',
|
},
|
||||||
deviceCount: 3,
|
connectPluginInstalled,
|
||||||
expireTime,
|
description: 'DevServer9000',
|
||||||
flashBackupActivated: !!connectPluginInstalled,
|
deviceCount: 3,
|
||||||
flashProduct: 'SanDisk_3.2Gen1',
|
expireTime,
|
||||||
flashVendor: 'USB',
|
flashBackupActivated: !!connectPluginInstalled,
|
||||||
guid: staticGuid,
|
flashProduct: 'SanDisk_3.2Gen1',
|
||||||
// "guid": "0781-5583-8355-81071A2B0211",
|
flashVendor: 'USB',
|
||||||
inIframe: false,
|
guid: staticGuid,
|
||||||
// keyfile: 'DUMMY_KEYFILE',
|
// "guid": "0781-5583-8355-81071A2B0211",
|
||||||
keyfile: 'TkJCrVyXMLWWGKZF6TCEvf0C86UYI9KfUDSOm7JoFP19tOMTMgLKcJ6QIOt9_9Psg_t0yF-ANmzSgZzCo94ljXoPm4BESFByR0K7nyY9KVvU8szLEUcBUT3xC2adxLrAXFNxiPeK-mZqt34n16uETKYvLKL_Sr5_JziG5L5lJFBqYZCPmfLMiguFo1vp0xL8pnBH7q8bYoBnePrAcAVb9mAGxFVPEInSPkMBfC67JLHz7XY1Y_K5bYIq3go9XPtLltJ53_U4BQiMHooXUBJCKXodpqoGxq0eV0IhNEYdauAhnTsG90qmGZig0hZalQ0soouc4JZEMiYEcZbn9mBxPg',
|
inIframe: false,
|
||||||
lanIp: '192.168.254.36',
|
// keyfile: 'DUMMY_KEYFILE',
|
||||||
license: '',
|
keyfile: 'TkJCrVyXMLWWGKZF6TCEvf0C86UYI9KfUDSOm7JoFP19tOMTMgLKcJ6QIOt9_9Psg_t0yF-ANmzSgZzCo94ljXoPm4BESFByR0K7nyY9KVvU8szLEUcBUT3xC2adxLrAXFNxiPeK-mZqt34n16uETKYvLKL_Sr5_JziG5L5lJFBqYZCPmfLMiguFo1vp0xL8pnBH7q8bYoBnePrAcAVb9mAGxFVPEInSPkMBfC67JLHz7XY1Y_K5bYIq3go9XPtLltJ53_U4BQiMHooXUBJCKXodpqoGxq0eV0IhNEYdauAhnTsG90qmGZig0hZalQ0soouc4JZEMiYEcZbn9mBxPg',
|
||||||
locale: 'en_US', // en_US, ja
|
lanIp: '192.168.254.36',
|
||||||
name: 'dev-static',
|
license: '',
|
||||||
osVersion,
|
locale: 'en_US', // en_US, ja
|
||||||
osVersionBranch,
|
name: 'dev-static',
|
||||||
// registered: connectPluginInstalled ? true : false,
|
osVersion,
|
||||||
registered: false,
|
osVersionBranch,
|
||||||
regGen: 0,
|
// registered: connectPluginInstalled ? true : false,
|
||||||
regTm: twoDaysAgo,
|
registered: false,
|
||||||
regTo: 'Zack Spear',
|
regGen: 0,
|
||||||
regTy,
|
regTm: twoDaysAgo,
|
||||||
regExp,
|
regTo: 'Zack Spear',
|
||||||
// "regGuid": "0781-5583-8355-81071A2B0211",
|
regTy,
|
||||||
site: 'http://localhost:4321',
|
regExp,
|
||||||
state,
|
// "regGuid": "0781-5583-8355-81071A2B0211",
|
||||||
theme: {
|
site: 'http://localhost:4321',
|
||||||
banner: false,
|
state,
|
||||||
bannerGradient: false,
|
theme: {
|
||||||
bgColor: '',
|
banner: false,
|
||||||
descriptionShow: true,
|
bannerGradient: false,
|
||||||
metaColor: '',
|
bgColor: '',
|
||||||
name: 'white',
|
descriptionShow: true,
|
||||||
textColor: ''
|
metaColor: '',
|
||||||
},
|
name: 'white',
|
||||||
updateOsResponse: {
|
textColor: ''
|
||||||
version: '6.13.0-beta0.27',
|
},
|
||||||
name: 'Unraid 6.13.0-beta0.27',
|
updateOsResponse: await mimicWebguiUnraidCheck(),
|
||||||
date: '2023-12-13',
|
uptime,
|
||||||
isNewer: true,
|
username: 'zspearmint',
|
||||||
},
|
wanFQDN: ''
|
||||||
uptime,
|
};
|
||||||
username: 'zspearmint',
|
console.debug('[getServerState]', { serverState });
|
||||||
wanFQDN: ''
|
return serverState;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import AES from 'crypto-js/aes';
|
import AES from 'crypto-js/aes';
|
||||||
import type { SendPayloads } from '~/store/callback';
|
|
||||||
|
|
||||||
import { serverState } from '~/_data/serverState';
|
import { getServerState } from '~/_data/serverState';
|
||||||
|
import type { SendPayloads } from '~/store/callback';
|
||||||
|
import type { Server } from '~/types/server';
|
||||||
|
|
||||||
|
const serverData = ref<Server | undefined>(undefined);
|
||||||
|
|
||||||
const nuxtApp = useNuxtApp();
|
const nuxtApp = useNuxtApp();
|
||||||
onBeforeMount(() => {
|
onBeforeMount(async () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
nuxtApp.$customElements.registerEntry('UnraidComponents');
|
nuxtApp.$customElements.registerEntry('UnraidComponents');
|
||||||
|
|
||||||
|
serverData.value = await getServerState();
|
||||||
});
|
});
|
||||||
|
|
||||||
const valueToMakeCallback = ref<SendPayloads | undefined>();
|
const valueToMakeCallback = ref<SendPayloads | undefined>();
|
||||||
@@ -64,7 +69,7 @@ onMounted(() => {
|
|||||||
UserProfileCe
|
UserProfileCe
|
||||||
</h3>
|
</h3>
|
||||||
<header class="bg-beta py-4">
|
<header class="bg-beta py-4">
|
||||||
<UserProfileCe :server="serverState" />
|
<UserProfileCe v-if="serverData" :server="serverData" />
|
||||||
</header>
|
</header>
|
||||||
<hr class="border-black dark:border-white">
|
<hr class="border-black dark:border-white">
|
||||||
<h3 class="text-lg font-semibold font-mono">
|
<h3 class="text-lg font-semibold font-mono">
|
||||||
|
|||||||
9
web/pages/newFile.ts
Normal file
9
web/pages/newFile.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { onBeforeMount } from 'vue';
|
||||||
|
import { nuxtApp } from './index.vue';
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
// @ts-ignore
|
||||||
|
nuxtApp.$customElements.registerEntry('UnraidComponents');
|
||||||
|
|
||||||
|
// serverData.value = await getServerState();
|
||||||
|
});
|
||||||
@@ -1,10 +1,16 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { serverState } from '~/_data/serverState';
|
import { getServerState } from '~/_data/serverState';
|
||||||
|
|
||||||
|
import type { Server } from '~/types/server';
|
||||||
|
|
||||||
|
const serverData = ref<Server | undefined>(undefined);
|
||||||
|
|
||||||
const nuxtApp = useNuxtApp();
|
const nuxtApp = useNuxtApp();
|
||||||
onBeforeMount(() => {
|
onBeforeMount(async () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
nuxtApp.$customElements.registerEntry('UnraidComponents');
|
nuxtApp.$customElements.registerEntry('UnraidComponents');
|
||||||
|
|
||||||
|
serverData.value = await getServerState();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -18,7 +24,7 @@ onBeforeMount(() => {
|
|||||||
UserProfileCe
|
UserProfileCe
|
||||||
</h3>
|
</h3>
|
||||||
<header class="bg-beta py-4">
|
<header class="bg-beta py-4">
|
||||||
<unraid-user-profile :server="JSON.stringify(serverState)" />
|
<unraid-user-profile v-if="serverData" :server="JSON.stringify(serverData)" />
|
||||||
</header>
|
</header>
|
||||||
<hr class="border-black dark:border-white">
|
<hr class="border-black dark:border-white">
|
||||||
<h3 class="text-lg font-semibold font-mono">
|
<h3 class="text-lg font-semibold font-mono">
|
||||||
|
|||||||
Reference in New Issue
Block a user