feat: update .gitignore, auth configuration, and add GitHub API client
This commit is contained in:
@@ -3,3 +3,5 @@ CONVEX_SELF_HOSTED_ADMIN_KEY=
|
||||
CONVEX_SELF_HOSTED_URL=http://localhost:3210
|
||||
# CONVEX_SELF_HOSTED_URL=https://convex.kevisual.cn
|
||||
CONVEX_SITE_URL=https://api-convex.kevisual.cn
|
||||
|
||||
KEVISUAL_CONVEX_TOKEN=
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@ release/*
|
||||
pack-dist
|
||||
|
||||
.pnpm-store
|
||||
|
||||
storage
|
||||
@@ -6,7 +6,7 @@ export default {
|
||||
type: "customJwt",
|
||||
applicationID: "convex-app",
|
||||
issuer: "https://convex.kevisual.cn",
|
||||
jwks: "https://api-convex.kevisual.cn/root/convex/jwks.json",
|
||||
jwks: "https://kevisual.cn/api/convex/jwks.json",
|
||||
algorithm: "RS256",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -3,6 +3,8 @@ import { query, mutation, action } from "../_generated/server.js";
|
||||
export const get = query({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
return await ctx.db.query("github_starred").collect();
|
||||
const user = await ctx.auth.getUserIdentity();
|
||||
console.log('user', user)
|
||||
return await ctx.db.query("github_starred").take(1);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"@types/node": "^25.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kevisual/auth": "^2.0.3",
|
||||
"convex": "1.31.7",
|
||||
"jose": "^6.1.3"
|
||||
}
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -8,6 +8,9 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@kevisual/auth':
|
||||
specifier: ^2.0.3
|
||||
version: 2.0.3
|
||||
convex:
|
||||
specifier: 1.31.7
|
||||
version: 1.31.7
|
||||
@@ -183,6 +186,9 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@kevisual/auth@2.0.3':
|
||||
resolution: {integrity: sha512-4xpijaIhlCTr/DlJaV/gmkCQeg45EO1yxWpRvUX+1jCdVbuxSR0wZrF0SD9oybnjmKWMKDNPLsXyduFjMGcItA==}
|
||||
|
||||
'@kevisual/types@0.0.12':
|
||||
resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==}
|
||||
|
||||
@@ -307,6 +313,8 @@ snapshots:
|
||||
'@esbuild/win32-x64@0.27.0':
|
||||
optional: true
|
||||
|
||||
'@kevisual/auth@2.0.3': {}
|
||||
|
||||
'@kevisual/types@0.0.12': {}
|
||||
|
||||
'@types/bun@1.3.8':
|
||||
|
||||
18
src/github/get.ts
Normal file
18
src/github/get.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { api } from '@/convex/_generated/api.js';
|
||||
import { ConvexClient, AuthTokenFetcher } from "convex/browser";
|
||||
const url = process.env["CONVEX_URL"]
|
||||
const client = new ConvexClient(url!);
|
||||
|
||||
const token = process.env["KEVISUAL_CONVEX_TOKEN"]
|
||||
const authTokenFetcher: AuthTokenFetcher = async ({ forceRefreshToken }: { forceRefreshToken: boolean }) => {
|
||||
console.log("AuthTokenFetcher called, forceRefreshToken:", forceRefreshToken);
|
||||
return token;
|
||||
}
|
||||
client.setAuth(authTokenFetcher, (isAuthenticated) => {
|
||||
console.log("Auth isAuthenticated:", isAuthenticated);
|
||||
});
|
||||
|
||||
await Bun.sleep(1000);
|
||||
const list = await client.query(api.github.starrred.get, {})
|
||||
|
||||
console.log('list', list)
|
||||
@@ -10,6 +10,9 @@
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
],
|
||||
"@/convex/*": [
|
||||
"convex/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user