feat: update .gitignore, auth configuration, and add GitHub API client

This commit is contained in:
2026-02-12 21:14:23 +08:00
parent d808f8b59b
commit 55414d0693
8 changed files with 40 additions and 4 deletions

View File

@@ -2,4 +2,6 @@
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
CONVEX_SITE_URL=https://api-convex.kevisual.cn
KEVISUAL_CONVEX_TOKEN=

4
.gitignore vendored
View File

@@ -12,4 +12,6 @@ release/*
!.env.example
pack-dist
.pnpm-store
.pnpm-store
storage

View File

@@ -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",
},
],

View File

@@ -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);
},
});

View File

@@ -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
View File

@@ -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
View 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)

View File

@@ -10,6 +10,9 @@
"paths": {
"@/*": [
"src/*"
],
"@/convex/*": [
"convex/*"
]
},
},