student life social platform
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(api): add server manifest

authored by

Gwen Le Bihan and committed by
Gwen Le Bihan
8d94a13a 9e53549c

+138
+5
.changeset/gentle-meals-compare.md
··· 1 + --- 2 + '@churros/api': minor 3 + --- 4 + 5 + add Query.version to get the current api version, and serve a server manifest at .well-known/churros.app/server.json
+10
packages/api/src/modules/global/resolvers/query.version.ts
··· 1 + import { CURRENT_VERSION, builder } from '#lib'; 2 + 3 + builder.queryField('version', (t) => 4 + t.string({ 5 + description: "Version actuelle de l'API", 6 + resolve() { 7 + return CURRENT_VERSION; 8 + }, 9 + }), 10 + );
+1
packages/api/src/server/express.ts
··· 55 55 console.error('Failed to initialize GraphQL server', error); 56 56 } 57 57 import('./log.js'); 58 + import('./wellknown.js'); 58 59 import('./booking-pdf.js'); 59 60 import('./handover-pdf.js'); 60 61 import('./storage.js');
+25
packages/api/src/server/wellknown.ts
··· 1 + import { CURRENT_VERSION, ENV } from '#lib'; 2 + import { api } from './express.js'; 3 + 4 + console.info(`Serving server manifest on /.well-known/churros.app/server.json`); 5 + api.get('/.well-known/churros.app/server.json', async (_req, res) => { 6 + res.json({ 7 + version: CURRENT_VERSION, 8 + urls: { 9 + api: ENV.PUBLIC_API_URL, 10 + auth: ENV.PUBLIC_API_AUTH_URL, 11 + }, 12 + oauth: { 13 + enabled: ENV.PUBLIC_OAUTH_ENABLED === '1', 14 + authorizeUrl: ENV.PUBLIC_OAUTH_AUTHORIZE_URL, 15 + tokenUrl: ENV.PUBLIC_OAUTH_TOKEN_URL, 16 + clientId: ENV.PUBLIC_OAUTH_CLIENT_ID, 17 + userInfoUrl: ENV.PUBLIC_OAUTH_USER_INFO_URL, 18 + scopes: ENV.PUBLIC_OAUTH_SCOPES?.join(' '), 19 + }, 20 + emails: { 21 + contact: ENV.PUBLIC_CONTACT_EMAIL, 22 + support: ENV.PUBLIC_SUPPORT_EMAIL, 23 + }, 24 + }); 25 + });
+4
packages/app/schema.graphql
··· 4743 4743 """ 4744 4744 userCandidatesCount: Int! 4745 4745 userServices: [Service!]! @deprecated(reason: "Use `services(mine: true)` instead") 4746 + """ 4747 + Version actuelle de l'API 4748 + """ 4749 + version: String! 4746 4750 } 4747 4751 4748 4752 type QueryAllFormsConnection {
+20
server-manifest.example.json
··· 1 + { 2 + "version": "5.0.1", 3 + "urls": { 4 + "api": "https://churros.inpt.fr/graphql", 5 + "auth": "https://churros.inpt.fr/auth" 6 + }, 7 + "oauth": { 8 + "enabled": true, 9 + "clientId": "y87JANYpibsGhWJorAgYO9AOPU9PtecC7WsZwDNo", 10 + "authorizeUrl": "https://auth.inpt.fr/application/o/authorize/", 11 + "tokenUrl": "https://auth.inpt.fr/application/o/token/", 12 + "logoutUrl": "https://auth.inpt.fr/application/o/churros/end-session/", 13 + "userInfoUrl": "https://auth.inpt.fr/application/o/userinfo/", 14 + "scopes": "openid profile email" 15 + }, 16 + "emails": { 17 + "contact": "contact@net7.dev", 18 + "support": "contact@net7.dev" 19 + } 20 + }
+73
server-manifest.schema.json
··· 1 + { 2 + "type": "object", 3 + "properties": { 4 + "version": { 5 + "type": "string", 6 + "pattern": "^(dev|(\\d+\\.\\d+\\.\\d+))$" 7 + }, 8 + "urls": { 9 + "type": "object", 10 + "properties": { 11 + "auth": { 12 + "type": "string", 13 + "format": "uri" 14 + }, 15 + "api": { 16 + "type": "string", 17 + "format": "uri" 18 + } 19 + }, 20 + "required": ["auth", "api"], 21 + "additionalProperties": false 22 + }, 23 + "oauth": { 24 + "type": "object", 25 + "properties": { 26 + "enabled": { 27 + "type": "boolean" 28 + }, 29 + "logoutUrl": { 30 + "type": "string", 31 + "format": "uri" 32 + }, 33 + "authorizeUrl": { 34 + "type": "string", 35 + "format": "uri" 36 + }, 37 + "clientId": { 38 + "type": "string" 39 + }, 40 + "tokenUrl": { 41 + "type": "string", 42 + "format": "uri" 43 + }, 44 + "userInfoUrl": { 45 + "type": "string", 46 + "format": "uri" 47 + }, 48 + "scopes": { 49 + "type": "string" 50 + } 51 + }, 52 + "required": ["enabled", "scopes"], 53 + "additionalProperties": false 54 + }, 55 + "emails": { 56 + "type": "object", 57 + "properties": { 58 + "support": { 59 + "type": "string", 60 + "format": "email" 61 + }, 62 + "contact": { 63 + "type": "string", 64 + "format": "email" 65 + } 66 + }, 67 + "additionalProperties": false 68 + } 69 + }, 70 + "required": ["version", "urls", "oauth", "emails"], 71 + "additionalProperties": false, 72 + "$schema": "http://json-schema.org/draft-07/schema#" 73 + }