விருந்தினர் GraphQL
பகிர்வு இணைப்பின் மூலம் மறைகுறியாக்கப்பட்ட அணுகல்.
key = Base64UrlDecode(shared_token)பகிர்வு இணைப்பிலுள்ள shared_token; c-id = shareId
https://<host>:<port>/guest_graphqlPOST /guest_graphql
c-id: 01a1cd7b-b900-7331-9331-313131313131
JSON({ requestId, query, variables })
requestId என்பது கோரிக்கை நேரத்தைக் கொண்ட UUIDv7. variables, operationName மற்றும் extensions விருப்பமானவை.
மீளனுப்பல் தாக்குதல் தடுப்பு
requestId = UUIDv7()JSON { requestId, query, variables } → authenticated encryptionshareId → shared_token✕ → நிராகரிக்கவும்|serverTime − requestId timestamp| ≤ 60 s✕ → நிராகரிக்கவும்SQLite: guest + shareId + requestIdநூலக அழைப்புகள்
Desktop குறியீட்டுப் பகுதிகள். அதே graphqlRequestPayload உதவி செயல்பாடு UUIDv7 requestId-ஐ உருவாக்குகிறது; தனி நேரமுத்திரையோ மீளனுப்பல் தடுப்பு nonce-ஓ அனுப்பப்படுவதில்லை.
// plain-desktop/src/lib/api/guest.ts
const payload = graphqlRequestPayload(query, variables)
const requestBody = chachaEncrypt(key, payload, httpRequestAad('/guest_graphql'))
const response = await httpRequest(url, {
method: 'POST', headers: { 'c-id': shareId }, body: requestBody
})
if (!response.ok) throw new Error(String(response.status))
const bytes = new Uint8Array(await response.arrayBuffer())
const result = JSON.parse(decryptGraphqlResponse(key, requestBody, bytes))
// Feature error codes are carried in extensions.code; message is diagnostic text.
if (result.errors?.length) throw GqlError.fromGraphql(result.errors[0])HTTP 403: செயலற்ற பகிர்வு அல்லது முடக்கப்பட்ட தொலை அணுகல். 401: மறைகுறி நீக்கம் தோல்வி. 400: தவறான வடிவிலான, காலாவதியான அல்லது மீண்டும் வந்த கோரிக்கை.
வகை வரையறைகள்
scalar Instant
scalar Long
type Query {
sharedInfo(: String, : String): SharedInfo!
}
type SharedFile {
name: String!
relativePath: String!
isDir: Boolean!
size: Long!
mimeType: String!
hasThumb: Boolean!
createdAt: Instant
updatedAt: Instant!
}
type SharedInfo {
name: String!
readOnly: Boolean!
requiresPassword: Boolean!
expiresAt: Instant
urlToken: String!
entries: [SharedFile!]!
}
"""
Directs the executor to include this field or fragment only when the `if` argument is true.
"""
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"""
Directs the executor to skip this field or fragment when the `if` argument is true.
"""
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}