<commit_before>import * as WebFinger from 'webfinger.js'
import { isTestInstance } from '@server/helpers/core-utils'
import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
import { REQUEST_TIMEOUT, WEBSERVER } from '@server/initializers/constants'
import { ActorModel } from '@server/models/actor/actor'
import { MActorFull } from '@server/types/models'
import { WebFingerData } from '@shared/models'

const webfinger = new WebFinger({
  webfist_fallback: false,
  tls_only: isTestInstance(),
  uri_fallback: false,
  request_timeout: REQUEST_TIMEOUT
})

async function loadActorUrlOrGetFromWebfinger (uriArg: string) {
  // Handle strings like <EMAIL>
  const uri = uriArg.startsWith('@') ? uriArg.slice(1) : uriArg
<commit_msg>Fix webfinger tls only<commit_after>import * as WebFinger from 'webfinger.js'
import { isProdInstance } from '@server/helpers/core-utils'
import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
import { REQUEST_TIMEOUT, WEBSERVER } from '@server/initializers/constants'
import { ActorModel } from '@server/models/actor/actor'
import { MActorFull } from '@server/types/models'
import { WebFingerData } from '@shared/models'

const webfinger = new WebFinger({
  webfist_fallback: false,
  tls_only: isProdInstance(),
  uri_fallback: false,
  request_timeout: REQUEST_TIMEOUT
})

async function loadActorUrlOrGetFromWebfinger (uriArg: string) {
  // Handle strings like <EMAIL>
  const uri = uriArg.startsWith('@') ? uriArg.slice(1) : uriArg

{'fraction_non_alphanumeric': 0.11435997400909681, 'fraction_numerical': 0.001299545159194282, 'mean_word_length': 5.814159292035399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2754988', 'n_tokens_mistral': 499, 'n_tokens_neox': 500, 'n_words': 115}