API Referansı

Misafir GraphQL

Paylaşım bağlantısıyla şifreli erişim.

key = Base64UrlDecode(shared_token)Paylaşım bağlantısından shared_token; c-id = shareId

İstemci
https://<host>:<port>/guest_graphql
Sunucu

POST /guest_graphql

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

HTTP · binary

JSON({ requestId, query, variables })

requestId UUIDv7'dir ve istek zamanını içerir. variables, operationName ve extensions isteğe bağlıdır.

XChaCha20-Poly1305 · Alanın üzerine gelin veya dokunun
1 / 2

Yeniden oynatma koruması

requestId = UUIDv7()JSON { requestId, query, variables } → authenticated encryption
↓ POST /guest_graphql
Kimlik doğrula ve şifreyi çözshareId → shared_token✕ → Reddet
↓
UUIDv7 zamanını doğrula|serverTime − requestId timestamp| ≤ 60 s✕ → Reddet
↓
Çalıştırmadan önce requestId kaydetSQLite: guest + shareId + requestId
✓ ↓GraphQL çalıştır
✕ ↓Yeniden kullanılan requestId değerini reddet
Kitaplık çağrıları

Desktop alıntıları. Aynı graphqlRequestPayload yardımcısı UUIDv7 requestId oluşturur; ayrı zaman damgası veya tekrar önleme nonce değeri gönderilmez.

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: etkin olmayan paylaşım veya uzaktan erişim kapalı. 401: şifre çözme başarısız. 400: hatalı biçimli, süresi dolmuş veya tekrarlanan istek.

Tip Tanımları

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
}