refactor: WIP trial requires account

This commit is contained in:
Zack Spear
2023-08-07 14:28:32 -07:00
committed by Zack Spear
parent 532cf5a0d7
commit 2e4997ea60
9 changed files with 132 additions and 48 deletions

View File

@@ -29,7 +29,7 @@ const randomGuid = `1111-1111-${makeid(4)}-123412341234`; // this guid is regist
// EBLACKLISTED1
// EBLACKLISTED2
// ENOCONN
const state: ServerState = 'EGUID';
const state: ServerState = 'ENOKEYFILE';
const uptime = Date.now() - 60 * 60 * 1000; // 1 hour ago
let expireTime = 0;

View File

@@ -55,4 +55,69 @@ const showExpireTime = computed(() => {
@tailwind base;
@tailwind components;
@tailwind utilities;
.DropdownWrapper_blip {
box-shadow: var(--ring-offset-shadow), var(--ring-shadow), var(--shadow-beta);
&::before {
@apply absolute z-20 block;
content: '';
width: 0;
height: 0;
top: -10px;
right: 42px;
border-right: 11px solid transparent;
border-bottom: 11px solid var(--color-alpha);
border-left: 11px solid transparent;
}
}
.unraid_mark_2,
.unraid_mark_4 {
animation: mark_2 1.5s ease infinite;
}
.unraid_mark_3 {
animation: mark_3 1.5s ease infinite;
}
.unraid_mark_6,
.unraid_mark_8 {
animation: mark_6 1.5s ease infinite;
}
.unraid_mark_7 {
animation: mark_7 1.5s ease infinite;
}
@keyframes mark_2 {
50% {
transform: translateY(-40px);
}
100% {
transform: translateY(0);
}
}
@keyframes mark_3 {
50% {
transform: translateY(-62px);
}
100% {
transform: translateY(0);
}
}
@keyframes mark_6 {
50% {
transform: translateY(40px);
}
100% {
transform: translateY(0);
}
}
@keyframes mark_7 {
50% {
transform: translateY(62px);
}
100% {
transform: translateY(0);
}
}
</style>

View File

@@ -7,12 +7,43 @@ export interface Props {
t: any;
}
withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps<Props>(), {
open: false,
});
const trialStore = useTrialStore();
const { trialModalLoading, trialStatus, trialStatusCopy } = storeToRefs(trialStore);
const { trialModalLoading, trialStatus } = storeToRefs(trialStore);
interface TrialStatusCopy {
heading: string;
subheading?: string;
}
const trialStatusCopy = computed((): TrialStatusCopy | null => {
switch (trialStatus.value) {
case 'failed':
return {
heading: props.t('Trial Key Creation Failed'),
subheading: props.t('Error creatiing a trial key. Please try again later.'),
};
case 'trialExtend':
return {
heading: props.t('Extending your free trial by 15 days'),
subheading: props.t('Please keep this window open'),
};
case 'trialStart':
return {
heading: props.t('Starting your free 30 day trial'),
subheading: props.t('Please keep this window open'),
};
case 'success':
return {
heading: props.t('Trial Key Created'),
subheading: props.t('Please wait while the page reloads to install your trial key'),
};
case 'ready':
return null;
}
});
const close = () => {
if (trialStatus.value === 'trialStart') { return console.debug('[close] not allowed'); }

View File

@@ -120,13 +120,13 @@
"Sign In with Unraid.net Account": "",
"Sign Out of Unraid.net": "",
"Extend Trial": "",
"Start Free 30 Day Trial": "",
"Start Free 30 day Trial": "",
"Go to Management Access Now": "",
"Contact Support": "",
"Learn More": "",
"No Keyfile": "",
"Let's Unleash your Hardware!": "",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30-day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30 day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "",
"Trial": "",
"Thank you for choosing Unraid OS!": "",
"<p>Your <em>Trial</em> key includes all the functionality and device support of a <em>Pro</em> key.</p><p>After your <em>Trial</em> has reached expiration, your server <strong>still functions normally</strong> until the next time you Stop the array or reboot your server.</p><p>At that point you may either purchase a license key or request a <em>Trial</em> extension.</p>": "",
@@ -180,7 +180,7 @@
"On January 1st, 2023 SSL certificates for unraid.net were deprecated. You MUST provision a new SSL certificate to use our new myunraid.net domain. You can do this on the Settings > Management Access page.": "",
"Unraid Connect Error": "",
"Trial Key Creation Failed": "",
"Key server did not return a trial key. Please try again later.": "",
"Error creatiing a trial key. Please try again later.": "",
"Extending your free trial by 15 days": "",
"Please keep this window open": "",
"Starting your free 30 day trial": "",

View File

@@ -120,13 +120,13 @@
"Sign In with Unraid.net Account": "Sign In with Unraid.net Account",
"Sign Out of Unraid.net": "Sign Out of Unraid.net",
"Extend Trial": "Extend Trial",
"Start Free 30 Day Trial": "Start Free 30 Day Trial",
"Start Free 30 day Trial": "Start Free 30 day Trial",
"Go to Management Access Now": "Go to Management Access Now",
"Contact Support": "Contact Support",
"Learn More": "Learn More",
"No Keyfile": "No Keyfile",
"Let's Unleash your Hardware!": "Let's Unleash your Hardware!",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30-day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "<p>Your server will not be usable until you purchase a Registration key or install a free 30-day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30 day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "<p>Your server will not be usable until you purchase a Registration key or install a free 30 day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>",
"Trial": "Trial",
"Thank you for choosing Unraid OS!": "Thank you for choosing Unraid OS!",
"<p>Your <em>Trial</em> key includes all the functionality and device support of a <em>Pro</em> key.</p><p>After your <em>Trial</em> has reached expiration, your server <strong>still functions normally</strong> until the next time you Stop the array or reboot your server.</p><p>At that point you may either purchase a license key or request a <em>Trial</em> extension.</p>": "<p>Your <em>Trial</em> key includes all the functionality and device support of a <em>Pro</em> key.</p><p>After your <em>Trial</em> has reached expiration, your server <strong>still functions normally</strong> until the next time you Stop the array or reboot your server.</p><p>At that point you may either purchase a license key or request a <em>Trial</em> extension.</p>",
@@ -180,7 +180,7 @@
"On January 1st, 2023 SSL certificates for unraid.net were deprecated. You MUST provision a new SSL certificate to use our new myunraid.net domain. You can do this on the Settings > Management Access page.": "On January 1st, 2023 SSL certificates for unraid.net were deprecated. You MUST provision a new SSL certificate to use our new myunraid.net domain. You can do this on the Settings > Management Access page.",
"Unraid Connect Error": "Unraid Connect Error",
"Trial Key Creation Failed": "Trial Key Creation Failed",
"Key server did not return a trial key. Please try again later.": "Key server did not return a trial key. Please try again later.",
"Error creatiing a trial key. Please try again later.": "Error creatiing a trial key. Please try again later.",
"Extending your free trial by 15 days": "Extending your free trial by 15 days",
"Please keep this window open": "Please keep this window open",
"Starting your free 30 day trial": "Starting your free 30 day trial",

View File

@@ -120,13 +120,13 @@
"Sign In with Unraid.net Account": "Unraid.net アカウントでサインインする",
"Sign Out of Unraid.net": "Unraid.net からサインアウトする",
"Extend Trial": "トライアルの延長",
"Start Free 30 Day Trial": "30 日間の無料トライアルを開始する",
"Start Free 30 day Trial": "30 日間の無料トライアルを開始する",
"Go to Management Access Now": "今すぐ管理アクセスに移動",
"Contact Support": "サポート問い合わせ先",
"Learn More": "もっと詳しく知る",
"No Keyfile": "キーファイルがありません",
"Let's Unleash your Hardware!": "ハードウェアを解き放ちましょう!",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30-day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "<p>登録キーを購入するか、30 日間の無料の<em>トライアル</em>キーをインストールするまで、サーバーは使用できません。 \n<em>トライアル</em> キーは、Pro 登録キーのすべての機能を提供します。</p><p>登録キーは、USB フラッシュ ブート デバイスのシリアル番号 (GUID) にバインドされています。\nサイズが少なくとも 1 GB の高品質の有名ブランドのデバイスを使用してください。</p><p>注: USB メモリ カード リーダーのほとんどは固有のシリアル番号を提示していないため、通常はサポートされていません。</p><p><strong>\n重要:</strong></p><ul class='list-disc pl-16px'><li>サーバー時間が 5 分以内であることを確認してください。</li><li>\n指定された DNS サーバー</li></ul>",
"<p>Your server will not be usable until you purchase a Registration key or install a free 30 day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class='list-disc pl-16px'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>": "<p>登録キーを購入するか、30 日間の無料の<em>トライアル</em>キーをインストールするまで、サーバーは使用できません。 \n<em>トライアル</em> キーは、Pro 登録キーのすべての機能を提供します。</p><p>登録キーは、USB フラッシュ ブート デバイスのシリアル番号 (GUID) にバインドされています。\nサイズが少なくとも 1 GB の高品質の有名ブランドのデバイスを使用してください。</p><p>注: USB メモリ カード リーダーのほとんどは固有のシリアル番号を提示していないため、通常はサポートされていません。</p><p><strong>\n重要:</strong></p><ul class='list-disc pl-16px'><li>サーバー時間が 5 分以内であることを確認してください。</li><li>\n指定された DNS サーバー</li></ul>",
"Trial": "トライアル",
"Thank you for choosing Unraid OS!": "Unraid OS をお選びいただきありがとうございます。",
"<p>Your <em>Trial</em> key includes all the functionality and device support of a <em>Pro</em> key.</p><p>After your <em>Trial</em> has reached expiration, your server <strong>still functions normally</strong> until the next time you Stop the array or reboot your server.</p><p>At that point you may either purchase a license key or request a <em>Trial</em> extension.</p>": "<p><em>トライアル</em> キーには、<em>プロ</em> キーのすべての機能とデバイス サポートが含まれています。</p><p><em>トライアル</em> の終了後\n有効期限に達しても、次回アレイを停止するかサーバーを再起動するまで、 サーバーは<strong>通常どおり機能</strong>します。</p><p>その時点で、ライセンス キーを購入するか、<em>ライセンス キーをリクエストすることができます。 \n> トライアル</em>拡張機能。</p>",
@@ -180,7 +180,7 @@
"On January 1st, 2023 SSL certificates for unraid.net were deprecated. You MUST provision a new SSL certificate to use our new myunraid.net domain. You can do this on the Settings > Management Access page.": "2023 年 1 月 1 日、unraid.net の SSL 証明書は廃止されました。 新しい myunraid.net ドメインを使用するには、新しい SSL 証明書をプロビジョニングする必要があります。 これは、「設定 > 管理アクセス」ページで行うことができます。",
"Unraid Connect Error": "非RAID接続エラー",
"Trial Key Creation Failed": "トライアルキーの作成に失敗しました",
"Key server did not return a trial key. Please try again later.": "キー サーバーが試用版キーを返しませんでした。 後でもう一度試してください。",
"Error creatiing a trial key. Please try again later.": "キー サーバーが試用版キーを返しませんでした。 後でもう一度試してください。",
"Extending your free trial by 15 days": "無料トライアルを 15 日間延長します",
"Please keep this window open": "この窓は開いたままにしておいてください",
"Starting your free 30 day trial": "30 日間の無料トライアルを開始する",

View File

@@ -63,6 +63,24 @@ export const useAccountStore = defineStore('account', () => {
type: 'signOut',
}]);
};
const trialExtend = () => {
console.debug('[accountStore.accountStore.trialExtend]');
callbackStore.send(`${ACCOUNT}/connect`, [{
server: {
...serverStore.serverAccountPayload,
},
type: 'trialExtend',
}]);
};
const trialStart = () => {
console.debug('[accountStore.accountStore.trialStart]');
callbackStore.send(`${ACCOUNT}/connect`, [{
server: {
...serverStore.serverAccountPayload,
},
type: 'trialStart',
}]);
};
/**
* @description Update myservers.cfg for both Sign In & Sign Out
* @note unraid-api requires apikey & token realted keys to be lowercase
@@ -151,6 +169,8 @@ export const useAccountStore = defineStore('account', () => {
replace,
signIn,
signOut,
trialExtend,
trialStart,
updatePluginConfig,
};
});

View File

@@ -273,18 +273,18 @@ export const useServerStore = defineStore('server', () => {
text: 'Sign Out of Unraid.net',
};
const trialExtendAction: ServerStateDataAction = {
click: () => { trialStore.setTrialStatus('trialExtend'); },
click: () => { accountStore.trialExtend(); },
external: true,
icon: KeyIcon,
name: 'trialExtend',
text: 'Extend Trial',
};
const trialStartAction: ServerStateDataAction = {
click: () => { trialStore.setTrialStatus('trialStart'); },
click: () => { accountStore.trialStart(); },
external: true,
icon: KeyIcon,
name: 'trialStart',
text: 'Start Free 30 Day Trial',
text: 'Start Free 30 day Trial',
};
let messageEGUID = '';
@@ -299,7 +299,7 @@ export const useServerStore = defineStore('server', () => {
],
humanReadable: 'No Keyfile',
heading: 'Let\'s Unleash your Hardware!',
message: '<p>Your server will not be usable until you purchase a Registration key or install a free 30-day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class=\'list-disc pl-16px\'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>',
message: '<p>Your server will not be usable until you purchase a Registration key or install a free 30 day <em>Trial</em> key. A <em>Trial</em> key provides all the functionality of a Pro Registration key.</p><p>Registration keys are bound to your USB Flash boot device serial number (GUID). Please use a high quality name brand device at least 1GB in size.</p><p>Note: USB memory card readers are generally not supported because most do not present unique serial numbers.</p><p><strong>Important:</strong></p><ul class=\'list-disc pl-16px\'><li>Please make sure your server time is accurate to within 5 minutes</li><li>Please make sure there is a DNS server specified</li></ul>',
};
case 'TRIAL':
return {

View File

@@ -24,36 +24,6 @@ export const useTrialStore = defineStore('trial', () => {
const trialModalLoading = computed(() => trialStatus.value === 'trialExtend' || trialStatus.value === 'trialStart');
const trialModalVisible = computed(() => trialStatus.value === 'failed' || trialStatus.value === 'trialExtend' || trialStatus.value === 'trialStart');
interface TrialStatusCopy {
heading: string;
subheading?: string;
}
const trialStatusCopy = computed((): TrialStatusCopy | null => {
switch (trialStatus.value) {
case 'failed':
return {
heading: 'Trial Key Creation Failed',
subheading: 'Key server did not return a trial key. Please try again later.',
};
case 'trialExtend':
return {
heading: 'Extending your free trial by 15 days',
subheading: 'Please keep this window open',
};
case 'trialStart':
return {
heading: 'Starting your free 30 day trial',
subheading: 'Please keep this window open',
};
case 'success':
return {
heading: 'Trial Key Created',
subheading: 'Please wait while the page reloads to install your trial key',
};
case 'ready':
return null;
}
});
const requestTrial = async (type?: TrialExtend | TrialStart) => {
console.debug('[requestTrial]');
@@ -113,8 +83,6 @@ export const useTrialStore = defineStore('trial', () => {
trialModalLoading,
trialModalVisible,
trialStatus,
// Getters
trialStatusCopy,
// Actions
requestTrial,
setTrialStatus,