mirror of
https://github.com/unraid/api.git
synced 2026-01-02 22:50:02 -06:00
feat: implement .env usage
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
NUXT_PUBLIC_CALLBACK_KEY=aNotSoSecretKeyUsedToObfuscateQueryParams
|
||||
NUXT_PUBLIC_UNRAID_NET=https://unraid.ddev.site
|
||||
NUXT_PUBLIC_ACCOUNT=https://localhost:8008
|
||||
VITE_ACCOUNT=https://localhost:8008
|
||||
VITE_CONNECT=https://connect.myunraid.net
|
||||
VITE_UNRAID_NET=https://unraid.ddev.site
|
||||
VITE_CALLBACK_KEY=aNotSoSecretKeyUsedToObfuscateQueryParams
|
||||
|
||||
4
.env.production
Normal file
4
.env.production
Normal file
@@ -0,0 +1,4 @@
|
||||
VITE_ACCOUNT=https://account.unraid.net
|
||||
VITE_CONNECT=https://connect.myunraid.net
|
||||
VITE_UNRAID_NET=https://unraid.net
|
||||
VITE_CALLBACK_KEY=Uyv2o8e*FiQe8VeLekTqyX6Z*8XonB
|
||||
4
.env.staging
Normal file
4
.env.staging
Normal file
@@ -0,0 +1,4 @@
|
||||
VITE_ACCOUNT=https://account.unraid.net
|
||||
VITE_CONNECT=https://connect.myunraid.net
|
||||
VITE_UNRAID_NET=https://staging.unraid.net
|
||||
VITE_CALLBACK_KEY=Uyv2o8e*FiQe8VeLekTqyX6Z*8XonB
|
||||
@@ -29,7 +29,7 @@ const randomGuid = `1111-1111-${makeid(4)}-123412341234`; // this guid is regist
|
||||
// EBLACKLISTED1
|
||||
// EBLACKLISTED2
|
||||
// ENOCONN
|
||||
const state: ServerState = 'ENOCONN';
|
||||
const state: ServerState = 'TRIAL';
|
||||
|
||||
const uptime = Date.now() - 60 * 60 * 1000; // 1 hour ago
|
||||
let expireTime = 0;
|
||||
|
||||
@@ -96,8 +96,7 @@ const { install } = useInstallPlugin();
|
||||
|
||||
<template #footer>
|
||||
<div class="w-full max-w-xs flex flex-col items-center gap-y-16px mx-auto">
|
||||
<!-- v-if="devEnv" -->
|
||||
<SwitchGroup as="div" class="flex items-center justify-center">
|
||||
<SwitchGroup v-if="import.meta.env.DEV" as="div" class="flex items-center justify-center">
|
||||
<Switch v-model="staging" :class="[staging ? 'bg-indigo-600' : 'bg-gray-200', 'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2']">
|
||||
<span aria-hidden="true" :class="[staging ? 't-x-5' : 't-x-0', 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out']" />
|
||||
</Switch>
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
/**
|
||||
* @todo setup .env
|
||||
*/
|
||||
const ACCOUNT = new URL('https://localhost:8008');
|
||||
const ACCOUNT = new URL(import.meta.env.VITE_ACCOUNT ?? 'https://account.unraid.net');
|
||||
const UNRAID_NET = new URL(import.meta.env.VITE_UNRAID_NET ?? 'https://unraid.net');
|
||||
|
||||
const ACCOUNT_CALLBACK = new URL('c', ACCOUNT);
|
||||
const CONNECT_DOCS = new URL('https://docs.unraid.net/category/unraid-connect');
|
||||
const CONNECT_DASHBOARD = new URL('https://connect.myunraid.net');
|
||||
const CONNECT_DASHBOARD = new URL(import.meta.env.VITE_CONNECT ?? 'https://connect.myunraid.net');
|
||||
const CONNECT_FORUMS = new URL('https://forums.unraid.net/forum/94-connect-plugin-support/');
|
||||
const CONTACT = new URL('https://unraid.net/contact');
|
||||
const CONTACT = new URL('/contact', UNRAID_NET);
|
||||
const DEV_GRAPH_URL = '';
|
||||
const DISCORD = new URL('https://discord.gg/unraid');
|
||||
const PURCHASE_CALLBACK = new URL('https://unraid.ddev.site/c');
|
||||
const PURCHASE_CALLBACK = new URL('/c', UNRAID_NET);
|
||||
|
||||
const SETTINGS_MANAGMENT_ACCESS = new URL('/Settings/ManagementAccess', window.location.origin);
|
||||
const PLUGIN_SETTINGS = new URL('#UnraidNetSettings', SETTINGS_MANAGMENT_ACCESS);
|
||||
|
||||
@@ -111,9 +111,11 @@ export const useCallbackStoreGeneric = (
|
||||
) =>
|
||||
defineStore('callback', () => {
|
||||
const callbackActions = useCallbackActions();
|
||||
const encryptionKey = 'Uyv2o8e*FiQe8VeLekTqyX6Z*8XonB';
|
||||
const encryptionKey = import.meta.env.VITE_CALLBACK_KEY;
|
||||
const defaultSendType = 'fromUpc';
|
||||
|
||||
console.debug('[callback]', import.meta.env);
|
||||
|
||||
const send = (url: string, payload: SendPayloads, sendType?: 'fromUpc' | 'forUpc') => {
|
||||
console.debug('[callback.send]');
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user