Compare commits
4 Commits
features/d
...
bug-featur
Author | SHA1 | Date | |
---|---|---|---|
8f24bb3cc1 | |||
fe8ea62a98 | |||
3b7f4d025d | |||
80737a2927 |
3
.env.example
Normal file
3
.env.example
Normal file
@ -0,0 +1,3 @@
|
||||
VITE_AKEYLESS_ACCESS_ID=""
|
||||
VITE_AKEYLESS_ACCESS_KEY=""
|
||||
VITE_AKEYLESS_KEY_PATH=""
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,4 +22,4 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
tokens.ts
|
||||
.env
|
@ -2,7 +2,4 @@ import "./style.css";
|
||||
|
||||
import { tokenList } from "./tokenList";
|
||||
import rootDiv from "./utils/root";
|
||||
|
||||
rootDiv!.innerHTML = `
|
||||
${tokenList()}
|
||||
`;
|
||||
rootDiv!.innerHTML = await tokenList();
|
||||
|
@ -2,6 +2,11 @@ export function toast(element: HTMLDivElement, message: string) {
|
||||
// Target our predefined DIV that will hold toast messages.
|
||||
const toastDiv = element.getElementsByClassName('toast')
|
||||
|
||||
const interval = setInterval(() => {
|
||||
toastDiv[0].remove()
|
||||
clearInterval(interval)
|
||||
}, 5000)
|
||||
|
||||
// If we currently have a toast displayed, let's remove it from the DOM.
|
||||
if (toastDiv && toastDiv.length != 0) {
|
||||
for (const el of toastDiv){
|
||||
|
@ -1,7 +1,6 @@
|
||||
import totp from 'totp-generator'
|
||||
const period = 30
|
||||
const digits = 6
|
||||
|
||||
export function displayToken(secret: string) {
|
||||
const token = totp(secret.replace(/ /g, '').trim(), {
|
||||
digits,
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { displayTokenListItem } from "./tokenListItem";
|
||||
import { tokens } from "./tokens";
|
||||
|
||||
export function tokenList() {
|
||||
return `<form id="tokens">${tokens.map((token) =>
|
||||
import { Token } from "./utils/types";
|
||||
console.log('tokens', tokens)
|
||||
export async function tokenList() {
|
||||
return `<form id="tokens">${tokens.map((token: Token) =>
|
||||
displayTokenListItem(token.account, token.secret)
|
||||
)}</form>`;
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
export const tokens = [
|
||||
{
|
||||
account: 'Github',
|
||||
secret: 'AFDAFDAFAFFD',
|
||||
},
|
||||
{
|
||||
account: 'Gmail',
|
||||
secret: 'AFDJKADFJsddfsKLAFSJLK',
|
||||
},
|
||||
]
|
10
src/tokens.ts
Normal file
10
src/tokens.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export const tokens = [
|
||||
{
|
||||
"account": "Github",
|
||||
"secret": "AFDAFDAFAFFD"
|
||||
},
|
||||
{
|
||||
"account": "Gmail",
|
||||
"secret": "AFDJKADFJsddfsKLAFSJLK"
|
||||
}
|
||||
]
|
15
src/utils/types.ts
Normal file
15
src/utils/types.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { tokens } from "../tokens";
|
||||
|
||||
export interface TokenResponse {
|
||||
token: string;
|
||||
creds: null;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
account: string;
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export interface GenericAPIResponse {
|
||||
result: string;
|
||||
}
|
Reference in New Issue
Block a user