-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73a5dbf
commit 75bac72
Showing
13 changed files
with
112 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
# Generate key using openssl rand -base64 32 | ||
|
||
NUXT_ADMIN_KEY_KEY=72st2uxZ8N9RJwCKPu+I3eTua6GHh09eRbKsmrZRqks= | ||
NUXT_PUBLIC_ADMIN_KEY_ENABLE=true | ||
NUXT_APP_ENABLE_DRIZZLE_LOGGING=false | ||
NUXT_DB_URL=http://db:8080 | ||
# Change to your own ip/domain address for S3 server | ||
NUXT_S3_ENDPOINT=http://192.168.100.119:9000 | ||
NUXT_S3_ACCESS_KEY_ID=7ebd63b0d9bb4218a837901ca0e571d4 | ||
NUXT_S3_SECRET_ACCESS_KEY=7ebd63b0d9bb4218a837901ca0e571d4 | ||
NUXT_JWT_KEY=5zRhfi/Aej8xhof7idF1uHPded9BpPeCkvEIZDHbnA0= | ||
NUXT_SIGNIN_KEY=vfJcr5Ian4xSYVm0k6qFOEJieZdfE6HXawEpr4bN/qI= | ||
NUXT_GOOGLE_CLIENT_ID= | ||
NUXT_GOOGLE_CLIENT_SECRET= | ||
NUXT_LOCAL_AUTHS=yunus1=a168746dc0bc427b9aac07a0c40c2efc;yunus2=d920d57cc4684580bee7f8db3a29e57c | ||
NUXT_PUBLIC_LOCAL_AUTH_ENABLED=true | ||
NUXT_APP_ENABLE_DRIZZLE_LOGGING=true | ||
NUXT_DB_URL=libsql://libsql.turso.io | ||
NUXT_DB_AUTH_TOKEN= | ||
NUXT_S3_ENDPOINT=https://s3endpoint | ||
NUXT_S3_ACCESS_KEY_ID=cd28e489b9a94daa893fa77b81fe82d4 | ||
NUXT_S3_SECRET_ACCESS_KEY=f98f62c0535f43ce954ad23e3a4c7a69 | ||
NUXT_JWT_KEY=36b3a2590d734b4aaf31bca4484647f6 | ||
NUXT_SIGNIN_KEY=a9a9e44d5344448789813e3ca7014d0e | ||
NUXT_PUBLIC_GOOGLE_CLIENT_ID= | ||
NUXT_APP_MIGRATION_ENABLE=true | ||
NUXT_APP_MIGRATION_DIR= | ||
NUXT_APP_CREATE_S3BUCKET=true | ||
NUXT_APP_API_AUTH_KEY=KJLZ5VrAPFs2jif6Mx15wuzILBwvZTVJ6Wis6bVs2iA= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
<div class="flex items-center justify-center h-full w-full"> | ||
<slot /> | ||
</div> | ||
</template> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { isNull } from "drizzle-orm" | ||
import type { EventHandlerRequest, H3Event } from "h3" | ||
import * as jose from 'jose' | ||
import { generateUserToken, signInUser } from "./sign-in-google.post" | ||
|
||
const alg = 'HS256' | ||
|
||
export default defineEventHandler(async event => { | ||
const { username, password } = await readValidatedBody(event, z.object({ | ||
username: z.string().min(1), | ||
password: z.string().min(1), | ||
}).parse) | ||
const localAuths = getLocalAuths(useRuntimeConfig(event).LOCAL_AUTHS) | ||
const localAuthed = localAuths.find(e => e.username === username && e.password === password) | ||
if (!localAuthed) { | ||
throw createError({ | ||
message: 'Invalid local auth', | ||
statusCode: 400, | ||
}) | ||
} | ||
const { token: userToken } = await generateUserToken(event, 'localauth', localAuthed.username, localAuthed.username, localAuthed.username) | ||
signInUser(event, userToken) | ||
const param = new URLSearchParams({ | ||
usr: userToken, | ||
e: localAuthed.username, | ||
}) | ||
return { | ||
param: param.toString(), | ||
} | ||
}) | ||
|
||
export function getLocalAuths(localAuths: string): { username: string, password: string }[] { | ||
return localAuths.split(';').map(e => { | ||
const s = e.split('=') | ||
return { | ||
username: s[0], | ||
password: s[1], | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters