refactor tokens

This commit is contained in:
smanylov
2026-06-01 14:48:13 +07:00
parent d7d2e36573
commit 743db57bb3
11 changed files with 105 additions and 127 deletions
+12 -12
View File
@@ -17,12 +17,12 @@ export async function requestFileWithTracking(fileId: string) {
method: 'POST',
body: JSON.stringify({
file_id: fileId,
token: token,
ip: ip,
user_agent: userAgent
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
@@ -57,12 +57,12 @@ export async function requestFileAsBuffer(fileId: string): Promise<ArrayBuffer |
method: 'POST',
body: JSON.stringify({
file_id: fileId,
token: token,
ip: ip,
user_agent: userAgent
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
@@ -100,12 +100,12 @@ export async function fetchDocumentInfo(fileId: string) {
msg_id: 20005,
message_body: {
file_id: fileId,
token: token,
action: 'file_info'
}
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
@@ -137,7 +137,6 @@ export async function filePermisionChange(fileId: string, permissions: boolean)
msg_id: 20005,
message_body: {
file_id: fileId,
token: token,
action: 'change_permission',
permissions: {
DOWNLOAD: permissions
@@ -145,7 +144,8 @@ export async function filePermisionChange(fileId: string, permissions: boolean)
}
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
@@ -182,7 +182,6 @@ export async function fetchHistoryView(
version: 1,
msg_id: 30028,
message_body: {
token: token,
action: 'history_view',
page: page,
size: size,
@@ -192,7 +191,8 @@ export async function fetchHistoryView(
}
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
@@ -223,12 +223,12 @@ export async function fetchTrackingStats() {
version: 1,
msg_id: 30028,
message_body: {
token: token,
action: 'view_stats'
}
}),
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});