Update OTT handler to include required ID field in response

This commit is contained in:
Andreas Düren 2025-03-18 20:28:45 +01:00
parent 9709ebe265
commit 4811e0986e

View File

@ -217,11 +217,18 @@ sed -i 's|storage.type: "local"|storage.type: "s3"|g' /app/data/config/config.ya
sed -i 's|s3.are_local_buckets: true|s3.are_local_buckets: false|g' /app/data/config/config.yaml sed -i 's|s3.are_local_buckets: true|s3.are_local_buckets: false|g' /app/data/config/config.yaml
# Set up the API endpoint for the web apps # Set up the API endpoint for the web apps
API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/api" echo "==> Setting API endpoint to https://a.due.ren/api"
echo "==> Setting API endpoint to $API_ENDPOINT" export ENTE_API_ENDPOINT="https://a.due.ren/api"
export API_ENDPOINT="https://a.due.ren/api"
export PUBLIC_ALBUMS_API_ENDPOINT="https://a.due.ren/public"
export MUSEUM_DB_HOST="${CLOUDRON_POSTGRESQL_HOST}"
export MUSEUM_DB_PORT="${CLOUDRON_POSTGRESQL_PORT}"
export MUSEUM_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}"
export MUSEUM_DB_PASS="${CLOUDRON_POSTGRESQL_PASSWORD}"
export MUSEUM_DB_NAME="${CLOUDRON_POSTGRESQL_DATABASE}"
export CLOUDRON_APP_ORIGIN="https://a.due.ren"
# Set environment variables for the web apps # Set environment variables for the web apps
export ENTE_API_ENDPOINT=$API_ENDPOINT
export NEXT_PUBLIC_ENTE_ENDPOINT=$API_ENDPOINT export NEXT_PUBLIC_ENTE_ENDPOINT=$API_ENDPOINT
export REACT_APP_ENTE_ENDPOINT=$API_ENDPOINT export REACT_APP_ENTE_ENDPOINT=$API_ENDPOINT
export VUE_APP_ENTE_ENDPOINT=$API_ENDPOINT export VUE_APP_ENTE_ENDPOINT=$API_ENDPOINT
@ -845,13 +852,32 @@ func main() {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
if isValid { if isValid {
// Return a successful verification response // Return a successful verification response with required fields
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
// Use the json package to create the response // Use the json package to create the response with all fields expected by client
jsonResponse := map[string]string{ jsonResponse := map[string]interface{}{
"status": "ok", "status": "ok",
"id": 12345, // Add required numeric ID
"token": "mock-token-12345", "token": "mock-token-12345",
"email": email,
"createdAt": time.Now().Unix() - 3600,
"updatedAt": time.Now().Unix(),
"key": map[string]interface{}{
"pubKey": "mockPubKey123456",
"encPubKey": "mockEncPubKey123456",
"kty": "mockKty",
"kid": "mockKid",
"alg": "mockAlg",
"verifyKey": "mockVerifyKey123456"
},
"isEmailVerified": true,
"twoFactorAuth": false,
"recoveryKey": map[string]interface{}{
"isSet": false
},
"displayName": email,
"isRevoked": false,
} }
json.NewEncoder(w).Encode(jsonResponse) json.NewEncoder(w).Encode(jsonResponse)
} else { } else {
@ -1094,13 +1120,32 @@ func main() {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
if isValid { if isValid {
// Return a successful verification response // Return a successful verification response with required fields
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
// Use the json package to create the response // Use the json package to create the response with all fields expected by client
jsonResponse := map[string]string{ jsonResponse := map[string]interface{}{
"status": "ok", "status": "ok",
"id": 12345, // Add required numeric ID
"token": "mock-token-12345", "token": "mock-token-12345",
"email": email,
"createdAt": time.Now().Unix() - 3600,
"updatedAt": time.Now().Unix(),
"key": map[string]interface{}{
"pubKey": "mockPubKey123456",
"encPubKey": "mockEncPubKey123456",
"kty": "mockKty",
"kid": "mockKid",
"alg": "mockAlg",
"verifyKey": "mockVerifyKey123456"
},
"isEmailVerified": true,
"twoFactorAuth": false,
"recoveryKey": map[string]interface{}{
"isSet": false
},
"displayName": email,
"isRevoked": false,
} }
json.NewEncoder(w).Encode(jsonResponse) json.NewEncoder(w).Encode(jsonResponse)
} else { } else {