Small tweaks

This commit is contained in:
dangered wolf 2023-08-21 19:22:31 -04:00
parent 57c0c78996
commit d37b1b3a38
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
2 changed files with 3 additions and 5 deletions

View file

@ -15,8 +15,7 @@ function generateCSRFToken() {
export const twitterFetch = async (
url: string,
event: FetchEvent,
useElongator = typeof TwitterProxy !== 'undefined' &&
experimentCheck(Experiment.ELONGATOR_BY_DEFAULT),
useElongator = experimentCheck(Experiment.ELONGATOR_BY_DEFAULT, typeof TwitterProxy !== 'undefined'),
validateFunction: (response: unknown) => boolean
): Promise<unknown> => {
let apiAttempts = 0;
@ -221,8 +220,7 @@ export const twitterFetch = async (
export const fetchConversation = async (
status: string,
event: FetchEvent,
useElongator = typeof TwitterProxy !== 'undefined' &&
experimentCheck(Experiment.ELONGATOR_BY_DEFAULT)
useElongator = experimentCheck(Experiment.ELONGATOR_BY_DEFAULT, typeof TwitterProxy !== 'undefined')
): Promise<TweetResultsByRestIdResult> => {
return (await twitterFetch(
`${

View file

@ -55,7 +55,7 @@ const htmlifyHashtags = (input: string): string => {
const hashtagPattern = /#([a-zA-Z_]\w*)/g;
return input.replace(hashtagPattern, (match, hashtag) => {
const encodedHashtag = encodeURIComponent(hashtag);
return `<a href="https://twitter.com/hashtag/${encodedHashtag}?src=hashtag_click">${match}</a>`;
return `<a href="${Constants.TWITTER_ROOT}/hashtag/${encodedHashtag}?src=hashtag_click">${match}</a>`;
});
};