PlainApp
API குறிப்பு

விருந்தினர் GraphQL

பகிர்வு இணைப்பின் மூலம் மறைகுறியாக்கப்பட்ட அணுகல்.

key = Base64UrlDecode(shared_token)பகிர்வு இணைப்பிலுள்ள shared_token; c-id = shareId

கிளையன்ட்
https://<host>:<port>/guest_graphql
சேவையகம்

POST /guest_graphql

c-id: 01a1cd7b-b900-7331-9331-313131313131

HTTP · binary

JSON({ requestId, query, variables })

requestId என்பது கோரிக்கை நேரத்தைக் கொண்ட UUIDv7. variables, operationName மற்றும் extensions விருப்பமானவை.

XChaCha20-Poly1305 · புலத்தில் சுட்டியை வைக்கவும் அல்லது தட்டவும்
1 / 2

மீளனுப்பல் தாக்குதல் தடுப்பு

requestId = UUIDv7()JSON { requestId, query, variables } → authenticated encryption
↓ POST /guest_graphql
அங்கீகரித்து மறைகுறி நீக்கவும்shareId → shared_token✕ → நிராகரிக்கவும்
↓
UUIDv7 நேரத்தைச் சரிபார்க்கவும்|serverTime − requestId timestamp| ≤ 60 s✕ → நிராகரிக்கவும்
↓
செயல்படுத்தும் முன் requestId-ஐப் பதிவு செய்யவும்SQLite: guest + shareId + requestId
✓ ↓GraphQL-ஐச் செயல்படுத்தவும்
✕ ↓மீண்டும் பயன்படுத்திய requestId-ஐ நிராகரிக்கவும்
நூலக அழைப்புகள்

Desktop குறியீட்டுப் பகுதிகள். அதே graphqlRequestPayload உதவி செயல்பாடு UUIDv7 requestId-ஐ உருவாக்குகிறது; தனி நேரமுத்திரையோ மீளனுப்பல் தடுப்பு nonce-ஓ அனுப்பப்படுவதில்லை.

typescript
// 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: தவறான வடிவிலான, காலாவதியான அல்லது மீண்டும் வந்த கோரிக்கை.

வகை வரையறைகள்

graphql
scalar Instant

scalar Long

type Query {
	sharedInfo(relativePath: String, password: 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
}