Skip to content

Commit 7e16b65

Browse files
committed
feat: add X-FS-TTL with feature flag
1 parent 7ffce65 commit 7e16b65

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

preload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ window.sessionFeatureFlags = {
6767
showPopoverAnchors: false,
6868
proAvailable: !isEmpty(process.env.SESSION_PRO),
6969
mockUserHasPro: !isEmpty(process.env.SESSION_HAS_PRO),
70+
fsTTL30s: !isEmpty(process.env.FILE_SERVER_TTL_30S),
7071
debug: {
7172
debugLogging: !isEmpty(process.env.SESSION_DEBUG),
7273
debugLibsessionDumps: !isEmpty(process.env.SESSION_DEBUG_LIBSESSION_DUMPS),

ts/models/message.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ export class MessageModel extends Model<MessageAttributes> {
775775
(this.get('attachments') || []).map(loadAttachmentData)
776776
);
777777
const body = this.get('body');
778-
779778
const quoteWithData = await loadQuoteData(this.get('quote'));
780779
const previewWithData = await loadPreviewData(this.get('preview'));
781780

ts/session/apis/file_server_api/FileServerApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const uploadFileToFsWithOnionV4 = async (
3838
endpoint: POST_GET_FILE_ENDPOINT,
3939
method: 'POST',
4040
timeoutMs: 30 * DURATION.SECONDS, // longer time for file upload
41+
headers: window.sessionFeatureFlags.fsTTL30s ? { 'X-FS-TTL': '30' } : {},
4142
});
4243

4344
if (!batchGlobalIsSuccess(result)) {

ts/session/onions/onionSend.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,13 @@ async function sendBinaryViaOnionV4ToFileServer({
486486
bodyBinary,
487487
abortSignal,
488488
timeoutMs,
489+
headers = {},
489490
}: WithTimeoutMs &
490491
WithAbortSignal & {
491492
endpoint: string;
492493
method: string;
493494
bodyBinary: Uint8Array;
495+
headers?: Record<string, string | number>;
494496
}): Promise<OnionV4JSONSnodeResponse | null> {
495497
if (!endpoint.startsWith('/')) {
496498
throw new Error('endpoint needs a leading /');
@@ -502,7 +504,7 @@ async function sendBinaryViaOnionV4ToFileServer({
502504
builtUrl,
503505
{
504506
method,
505-
headers: {},
507+
headers,
506508
body: bodyBinary,
507509
useV4: true,
508510
},

ts/state/ducks/types/releasedFeaturesReduxTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type SessionFeatureFlags = {
1313
debugInputCommands: boolean;
1414
proAvailable: boolean;
1515
mockUserHasPro: boolean;
16+
fsTTL30s: boolean;
1617
};
1718

1819
export type SessionFeatureFlagKeys = RecursiveKeys<SessionFeatureFlags>;

0 commit comments

Comments
 (0)