mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-05-15 22:26:58 +00:00
Add auth action
This commit is contained in:
parent
42f870b466
commit
8b22e65646
10
src/App.tsx
10
src/App.tsx
@ -2513,7 +2513,7 @@ function App() {
|
|||||||
setExtstate('create-wallet');
|
setExtstate('create-wallet');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:create_account', { postProcess: 'capitalize' })}
|
{t('auth:action.create_account', { postProcess: 'capitalize' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -2610,7 +2610,7 @@ function App() {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:authenticate', { postProcess: 'capitalize' })}
|
{t('auth:action.authenticate', { postProcess: 'capitalize' })}
|
||||||
</TextP>
|
</TextP>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@ -2662,7 +2662,7 @@ function App() {
|
|||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
|
|
||||||
<CustomButton onClick={authenticateWallet}>
|
<CustomButton onClick={authenticateWallet}>
|
||||||
{t('auth:authenticate', { postProcess: 'capitalize' })}
|
{t('auth:action.authenticate', { postProcess: 'capitalize' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
|
||||||
<ErrorText>{walletToBeDecryptedError}</ErrorText>
|
<ErrorText>{walletToBeDecryptedError}</ErrorText>
|
||||||
@ -2930,7 +2930,9 @@ function App() {
|
|||||||
<Spacer height="17px" />
|
<Spacer height="17px" />
|
||||||
|
|
||||||
<CustomButton onClick={createAccountFunc}>
|
<CustomButton onClick={createAccountFunc}>
|
||||||
{t('auth:create_account', { postProcess: 'capitalize' })}
|
{t('auth:action.create_account', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
</Box>
|
</Box>
|
||||||
<ErrorText>{walletToBeDownloadedError}</ErrorText>
|
<ErrorText>{walletToBeDownloadedError}</ErrorText>
|
||||||
|
@ -572,7 +572,7 @@ export const NotAuthenticated = ({
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:create_account', { postProcess: 'capitalize' })}
|
{t('auth:action.create_account', { postProcess: 'capitalize' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
</HtmlTooltip>
|
</HtmlTooltip>
|
||||||
</Box>
|
</Box>
|
||||||
@ -953,7 +953,9 @@ export const NotAuthenticated = ({
|
|||||||
setCustomNodeToSaveIndex(null);
|
setCustomNodeToSaveIndex(null);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:return_to_list', { postProcess: 'capitalize' })}
|
{t('auth:action.return_to_list', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -83,7 +83,6 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let error: any = null;
|
|
||||||
const uniqueInitialMap = new Map();
|
const uniqueInitialMap = new Map();
|
||||||
|
|
||||||
// Only add a message if it doesn't already exist in the Map
|
// Only add a message if it doesn't already exist in the Map
|
||||||
@ -223,7 +222,12 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
|
|||||||
|
|
||||||
{rawWallet && (
|
{rawWallet && (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography>Selected Account:</Typography> // TODO translate
|
<Typography>
|
||||||
|
{t('auth:account.selected', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
|
:
|
||||||
|
</Typography>
|
||||||
{rawWallet?.name && <Typography>{rawWallet.name}</Typography>}
|
{rawWallet?.name && <Typography>{rawWallet.name}</Typography>}
|
||||||
{rawWallet?.address0 && (
|
{rawWallet?.address0 && (
|
||||||
<Typography>{rawWallet?.address0}</Typography>
|
<Typography>{rawWallet?.address0}</Typography>
|
||||||
@ -233,12 +237,12 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
|
|||||||
{wallets?.length > 0 && (
|
{wallets?.length > 0 && (
|
||||||
<List
|
<List
|
||||||
sx={{
|
sx={{
|
||||||
width: '100%',
|
|
||||||
maxWidth: '500px',
|
|
||||||
maxHeight: '60vh',
|
|
||||||
overflowY: 'auto',
|
|
||||||
overflowX: 'hidden',
|
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
|
maxHeight: '60vh',
|
||||||
|
maxWidth: '500px',
|
||||||
|
overflowX: 'hidden',
|
||||||
|
overflowY: 'auto',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{wallets?.map((wallet, idx) => {
|
{wallets?.map((wallet, idx) => {
|
||||||
@ -260,11 +264,11 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
|
|||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
alignItems: 'center',
|
||||||
|
bottom: wallets?.length === 0 ? 'unset' : '20px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
gap: '10px',
|
gap: '10px',
|
||||||
alignItems: 'center',
|
|
||||||
position: wallets?.length === 0 ? 'relative' : 'fixed',
|
position: wallets?.length === 0 ? 'relative' : 'fixed',
|
||||||
bottom: wallets?.length === 0 ? 'unset' : '20px',
|
|
||||||
right: wallets?.length === 0 ? 'unset' : '20px',
|
right: wallets?.length === 0 ? 'unset' : '20px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -278,9 +282,7 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
|
|||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Already have a Qortal account? Enter your secret backup phrase
|
{t('auth:tips.existing_account', { postProcess: 'capitalize' })}
|
||||||
here to access it. This phrase is one of the ways to recover
|
|
||||||
your account.
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ export const DownloadWallet = ({
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:download_account', { postProcess: 'capitalize' })}
|
{t('auth:action.download_account', { postProcess: 'capitalize' })}
|
||||||
</TextP>
|
</TextP>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@ -247,13 +247,13 @@ export const DownloadWallet = ({
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await saveFileToDiskFunc();
|
await saveFileToDiskFunc();
|
||||||
await showInfo({
|
await showInfo({
|
||||||
message: t('auth:keep_secure', {
|
message: t('auth:message.generic.keep_secure', {
|
||||||
postProcess: 'capitalize',
|
postProcess: 'capitalize',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('auth:download_account', {
|
{t('auth:action.download_account', {
|
||||||
postProcess: 'capitalize',
|
postProcess: 'capitalize',
|
||||||
})}
|
})}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
@ -36,7 +36,7 @@ export const NewUsersCTA = ({ balance }) => {
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:question.new_user', { postProcess: 'capitalize' })}
|
{t('core:message.question.new_user', { postProcess: 'capitalize' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
|
@ -2,7 +2,15 @@
|
|||||||
"account": {
|
"account": {
|
||||||
"your": "your account",
|
"your": "your account",
|
||||||
"account_many": "accounts",
|
"account_many": "accounts",
|
||||||
"account_one": "account"
|
"account_one": "account",
|
||||||
|
"selected": "selected account"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"add_seed_phrase": "add seed-phrase",
|
||||||
|
"authenticate": "authenticate",
|
||||||
|
"create_account": "create account",
|
||||||
|
"download_account": "download account",
|
||||||
|
"return_to_list": "return to list"
|
||||||
},
|
},
|
||||||
"advanced_users": "for advanced users",
|
"advanced_users": "for advanced users",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
@ -13,17 +21,14 @@
|
|||||||
"key": "API key",
|
"key": "API key",
|
||||||
"select_valid": "select a valid apikey"
|
"select_valid": "select a valid apikey"
|
||||||
},
|
},
|
||||||
"authenticate": "authenticate",
|
|
||||||
"build_version": "build version",
|
"build_version": "build version",
|
||||||
"create_account": "create account",
|
|
||||||
"download_account": "download account",
|
|
||||||
"keep_secure": "keep your account file secure",
|
|
||||||
"message": {
|
"message": {
|
||||||
"error": {
|
"error": {
|
||||||
"account_creation": "could not create account."
|
"account_creation": "could not create account."
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
"no_account": "No accounts saved",
|
"no_account": "No accounts saved",
|
||||||
|
"keep_secure": "keep your account file secure",
|
||||||
"your_accounts": "your saved accounts"
|
"your_accounts": "your saved accounts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -37,9 +42,9 @@
|
|||||||
},
|
},
|
||||||
"password": "password",
|
"password": "password",
|
||||||
"password_confirmation": "confirm password",
|
"password_confirmation": "confirm password",
|
||||||
"return_to_list": "return to list",
|
|
||||||
"tips": {
|
"tips": {
|
||||||
"digital_id": "your wallet is like your digital ID on Qortal, and is how you will login to the Qortal User Interface. It holds your public address and the Qortal name you will eventually choose. Every transaction you make is linked to your ID, and this is where you manage all your QORT and other tradeable cryptocurrencies on Qortal.",
|
"digital_id": "your wallet is like your digital ID on Qortal, and is how you will login to the Qortal User Interface. It holds your public address and the Qortal name you will eventually choose. Every transaction you make is linked to your ID, and this is where you manage all your QORT and other tradeable cryptocurrencies on Qortal.",
|
||||||
|
"existing_account": "already have a Qortal account? Enter your secret backup phrase here to access it. This phrase is one of the ways to recover your account.",
|
||||||
"new_account": "creating an account means creating a new wallet and digital ID to start using Qortal. Once you have made your account, you can start doing things like obtaining some QORT, buying a name and avatar, publishing videos and blogs, and much more.",
|
"new_account": "creating an account means creating a new wallet and digital ID to start using Qortal. Once you have made your account, you can start doing things like obtaining some QORT, buying a name and avatar, publishing videos and blogs, and much more.",
|
||||||
"new_users": "new users start here!"
|
"new_users": "new users start here!"
|
||||||
},
|
},
|
||||||
|
@ -67,6 +67,9 @@
|
|||||||
"missing_field": "missing: {{ field }}",
|
"missing_field": "missing: {{ field }}",
|
||||||
"save_qdn": "unable to save to QDN"
|
"save_qdn": "unable to save to QDN"
|
||||||
},
|
},
|
||||||
|
"question": {
|
||||||
|
"new_user": "are you a new user?"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"minting": "(minting)",
|
"minting": "(minting)",
|
||||||
"not_minting": "(not minting)",
|
"not_minting": "(not minting)",
|
||||||
@ -90,9 +93,6 @@
|
|||||||
"payment_notification": "payment notification",
|
"payment_notification": "payment notification",
|
||||||
"price": "price",
|
"price": "price",
|
||||||
"q_mail": "q-mail",
|
"q_mail": "q-mail",
|
||||||
"question": {
|
|
||||||
"new_user": "are you a new user?"
|
|
||||||
},
|
|
||||||
"save_options": {
|
"save_options": {
|
||||||
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
||||||
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
||||||
|
@ -1,56 +1,58 @@
|
|||||||
export class RequestQueueWithPromise {
|
export class RequestQueueWithPromise {
|
||||||
constructor(maxConcurrent = 5) {
|
constructor(maxConcurrent = 5) {
|
||||||
this.queue = [];
|
this.queue = [];
|
||||||
this.maxConcurrent = maxConcurrent;
|
this.maxConcurrent = maxConcurrent;
|
||||||
this.currentlyProcessing = 0;
|
this.currentlyProcessing = 0;
|
||||||
this.isPaused = false; // Flag to track whether the queue is paused
|
this.isPaused = false; // Flag to track whether the queue is paused
|
||||||
}
|
|
||||||
|
|
||||||
// Add a request to the queue and return a promise
|
|
||||||
enqueue(request) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
// Push the request and its resolve and reject callbacks to the queue
|
|
||||||
this.queue.push({ request, resolve, reject });
|
|
||||||
this.process();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process requests in the queue
|
|
||||||
async process() {
|
|
||||||
// Process requests only if the queue is not paused
|
|
||||||
if (this.isPaused) return;
|
|
||||||
|
|
||||||
while (this.queue.length > 0 && this.currentlyProcessing < this.maxConcurrent) {
|
|
||||||
this.currentlyProcessing++;
|
|
||||||
|
|
||||||
const { request, resolve, reject } = this.queue.shift();
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await request();
|
|
||||||
resolve(response);
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
} finally {
|
|
||||||
this.currentlyProcessing--;
|
|
||||||
await this.process();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pause the queue processing
|
|
||||||
pause() {
|
|
||||||
this.isPaused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resume the queue processing
|
|
||||||
resume() {
|
|
||||||
this.isPaused = false;
|
|
||||||
this.process(); // Continue processing when resumed
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear pending requests in the queue
|
|
||||||
clear() {
|
|
||||||
this.queue.length = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a request to the queue and return a promise
|
||||||
|
enqueue(request) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// Push the request and its resolve and reject callbacks to the queue
|
||||||
|
this.queue.push({ request, resolve, reject });
|
||||||
|
this.process();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process requests in the queue
|
||||||
|
async process() {
|
||||||
|
// Process requests only if the queue is not paused
|
||||||
|
if (this.isPaused) return;
|
||||||
|
|
||||||
|
while (
|
||||||
|
this.queue.length > 0 &&
|
||||||
|
this.currentlyProcessing < this.maxConcurrent
|
||||||
|
) {
|
||||||
|
this.currentlyProcessing++;
|
||||||
|
|
||||||
|
const { request, resolve, reject } = this.queue.shift();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await request();
|
||||||
|
resolve(response);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
} finally {
|
||||||
|
this.currentlyProcessing--;
|
||||||
|
await this.process();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause the queue processing
|
||||||
|
pause() {
|
||||||
|
this.isPaused = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resume the queue processing
|
||||||
|
resume() {
|
||||||
|
this.isPaused = false;
|
||||||
|
this.process(); // Continue processing when resumed
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear pending requests in the queue
|
||||||
|
clear() {
|
||||||
|
this.queue.length = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user