From ce04b8d4e08bb94fde6a5e575637d09acaa9c5d4 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Mon, 29 Apr 2024 23:04:33 -0400 Subject: [PATCH] Add IV_FORCE_THREAD_UNROLL experiment --- src/experiments.ts | 6 ++++++ src/realms/twitter/routes/status.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/experiments.ts b/src/experiments.ts index 6357557..83127c1 100644 --- a/src/experiments.ts +++ b/src/experiments.ts @@ -1,4 +1,5 @@ export enum Experiment { + IV_FORCE_THREAD_UNROLL = 'IV_FORCE_THREAD_UNROLL', ELONGATOR_BY_DEFAULT = 'ELONGATOR_BY_DEFAULT', ELONGATOR_PROFILE_API = 'ELONGATOR_PROFILE_API', TWEET_DETAIL_API = 'TWEET_DETAIL_API' @@ -11,6 +12,11 @@ type ExperimentConfig = { }; const Experiments: { [key in Experiment]: ExperimentConfig } = { + [Experiment.IV_FORCE_THREAD_UNROLL]: { + name: 'IV force thread unroll', + description: 'Force thread unroll for IVs', + percentage: 0.1 + }, [Experiment.ELONGATOR_BY_DEFAULT]: { name: 'Elongator by default', description: 'Enable Elongator by default (guest token lockout bypass)', diff --git a/src/realms/twitter/routes/status.ts b/src/realms/twitter/routes/status.ts index 0c46ae9..4138e70 100644 --- a/src/realms/twitter/routes/status.ts +++ b/src/realms/twitter/routes/status.ts @@ -3,6 +3,7 @@ import { Constants } from '../../../constants'; import { getBaseRedirectUrl } from '../router'; import { handleStatus } from '../../../embed/status'; import { Strings } from '../../../strings'; +import { Experiment, experimentCheck } from '../../../experiments'; /* Handler for status request */ export const statusRequest = async (c: Context) => { @@ -55,7 +56,7 @@ export const statusRequest = async (c: Context) => { } else if (Constants.INSTANT_VIEW_DOMAINS.includes(url.hostname)) { console.log('Forced instant view request'); flags.forceInstantView = true; - } else if (Constants.INSTANT_VIEW_THREADS_DOMAINS.includes(url.hostname)) { + } else if (experimentCheck(Experiment.IV_FORCE_THREAD_UNROLL, userAgent.includes('Telegram')) || Constants.INSTANT_VIEW_THREADS_DOMAINS.includes(url.hostname)) { console.log('Forced unroll instant view'); flags.forceInstantView = true; flags.instantViewUnrollThreads = true;