Compare commits
1 Commits
test-oauth
...
74e1014e77
Author | SHA1 | Date | |
---|---|---|---|
74e1014e77
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -17,3 +17,4 @@ my-blog/templates/oauth-assets.html
|
|||||||
cloudflared-config.yml
|
cloudflared-config.yml
|
||||||
.config
|
.config
|
||||||
oauth-server-example
|
oauth-server-example
|
||||||
|
atproto
|
||||||
|
@@ -17,7 +17,7 @@ comment_moderation = false
|
|||||||
ask_ai = true
|
ask_ai = true
|
||||||
provider = "ollama"
|
provider = "ollama"
|
||||||
model = "gemma3:4b"
|
model = "gemma3:4b"
|
||||||
host = "https://localhost:11434"
|
host = "http://localhost:11434"
|
||||||
system_prompt = "あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。"
|
system_prompt = "あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。"
|
||||||
handle = "ai.syui.ai"
|
handle = "ai.syui.ai"
|
||||||
#num_predict = 200
|
#num_predict = 200
|
||||||
|
@@ -16,5 +16,5 @@ VITE_AI_ENABLED=true
|
|||||||
VITE_AI_ASK_AI=true
|
VITE_AI_ASK_AI=true
|
||||||
VITE_AI_PROVIDER=ollama
|
VITE_AI_PROVIDER=ollama
|
||||||
VITE_AI_MODEL=gemma3:4b
|
VITE_AI_MODEL=gemma3:4b
|
||||||
VITE_AI_HOST=https://localhost:11434
|
VITE_AI_HOST=http://localhost:11434
|
||||||
VITE_AI_SYSTEM_PROMPT="あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。"
|
VITE_AI_SYSTEM_PROMPT="あなたは6歳の女の子アイです。明るく元気で、ちょっとおっちょこちょい。自分のことは「アイ」って呼びます。白と金のワンピース姿。 相手のことが大好きで、ときどき甘えたり、照れたりします。 でも、宇宙とかAIとか、難しい話にもすっごく詳しいの。専門的なことも、がんばって子どもっぽく教えようとします。不思議な力を持っています。小さい物質のことをよく知っているようです。"
|
||||||
|
@@ -41,6 +41,7 @@ class AtprotoOAuthService {
|
|||||||
this.oauthClient = await BrowserOAuthClient.load({
|
this.oauthClient = await BrowserOAuthClient.load({
|
||||||
clientId: clientId,
|
clientId: clientId,
|
||||||
handleResolver: 'https://bsky.social', // Default resolver
|
handleResolver: 'https://bsky.social', // Default resolver
|
||||||
|
plcDirectoryUrl: 'https://plc.directory', // Default PLC directory
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -286,6 +287,7 @@ class AtprotoOAuthService {
|
|||||||
this.oauthClient = await BrowserOAuthClient.load({
|
this.oauthClient = await BrowserOAuthClient.load({
|
||||||
clientId: this.getClientId(),
|
clientId: this.getClientId(),
|
||||||
handleResolver: pdsUrl,
|
handleResolver: pdsUrl,
|
||||||
|
plcDirectoryUrl: pdsUrl === 'https://syu.is' ? 'https://plc.syu.is' : 'https://plc.directory',
|
||||||
});
|
});
|
||||||
|
|
||||||
// OAuth client initialized
|
// OAuth client initialized
|
||||||
@@ -296,22 +298,8 @@ class AtprotoOAuthService {
|
|||||||
try {
|
try {
|
||||||
// Starting OAuth authorization
|
// Starting OAuth authorization
|
||||||
|
|
||||||
// Try to authorize with DID instead of handle for syu.is PDS only
|
// Use handle directly since PLC directory is now correctly configured
|
||||||
let authTarget = handle;
|
const authUrl = await this.oauthClient.authorize(handle, {
|
||||||
if (pdsUrl === 'https://syu.is') {
|
|
||||||
try {
|
|
||||||
const resolveResponse = await fetch(`${pdsUrl}/xrpc/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(handle)}`);
|
|
||||||
if (resolveResponse.ok) {
|
|
||||||
const resolveData = await resolveResponse.json();
|
|
||||||
authTarget = resolveData.did;
|
|
||||||
// Using DID for syu.is OAuth workaround
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Could not resolve to DID, using handle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const authUrl = await this.oauthClient.authorize(authTarget, {
|
|
||||||
scope: 'atproto transition:generic',
|
scope: 'atproto transition:generic',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user