Compare commits
6 Commits
features/t
...
bug-featur
Author | SHA1 | Date | |
---|---|---|---|
8f24bb3cc1 | |||
fe8ea62a98 | |||
3b7f4d025d | |||
80737a2927 | |||
e0d4cb41b0 | |||
c1b9a1fa41 |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/*
|
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
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
tokens.ts
|
.env
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM node:18 AS Build
|
||||||
|
WORKDIR /app/node/
|
||||||
|
COPY . .
|
||||||
|
RUN yarn
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
FROM nginx AS Production
|
||||||
|
WORKDIR /usr/share/nginx/html
|
||||||
|
COPY --from=Build /app/node/dist /usr/share/nginx/html/
|
@ -2,7 +2,4 @@ import "./style.css";
|
|||||||
|
|
||||||
import { tokenList } from "./tokenList";
|
import { tokenList } from "./tokenList";
|
||||||
import rootDiv from "./utils/root";
|
import rootDiv from "./utils/root";
|
||||||
|
rootDiv!.innerHTML = await tokenList();
|
||||||
rootDiv!.innerHTML = `
|
|
||||||
${tokenList()}
|
|
||||||
`;
|
|
||||||
|
@ -2,6 +2,11 @@ export function toast(element: HTMLDivElement, message: string) {
|
|||||||
// Target our predefined DIV that will hold toast messages.
|
// Target our predefined DIV that will hold toast messages.
|
||||||
const toastDiv = element.getElementsByClassName('toast')
|
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 we currently have a toast displayed, let's remove it from the DOM.
|
||||||
if (toastDiv && toastDiv.length != 0) {
|
if (toastDiv && toastDiv.length != 0) {
|
||||||
for (const el of toastDiv){
|
for (const el of toastDiv){
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import totp from 'totp-generator'
|
import totp from 'totp-generator'
|
||||||
const period = 30
|
const period = 30
|
||||||
const digits = 6
|
const digits = 6
|
||||||
|
export function displayToken(secret: string) {
|
||||||
export function displayToken(secret) {
|
|
||||||
const token = totp(secret.replace(/ /g, '').trim(), {
|
const token = totp(secret.replace(/ /g, '').trim(), {
|
||||||
digits,
|
digits,
|
||||||
period,
|
period,
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { displayTokenListItem } from "./TokenListItem";
|
import { displayTokenListItem } from "./tokenListItem";
|
||||||
import { tokens } from "./tokens";
|
import { tokens } from "./tokens";
|
||||||
|
import { Token } from "./utils/types";
|
||||||
export function tokenList() {
|
console.log('tokens', tokens)
|
||||||
return `<form id="tokens">${tokens.map((token) =>
|
export async function tokenList() {
|
||||||
|
return `<form id="tokens">${tokens.map((token: Token) =>
|
||||||
displayTokenListItem(token.account, token.secret)
|
displayTokenListItem(token.account, token.secret)
|
||||||
)}</form>`;
|
)}</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;
|
||||||
|
}
|
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||||
|
"types": [],
|
||||||
|
"allowJs": false,
|
||||||
|
"skipLibCheck": false,
|
||||||
|
"esModuleInterop": false,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react"
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
Reference in New Issue
Block a user