mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
refactor(imports): replace relative imports with path aliases (#2741)
This commit is contained in:
1 parent
a59b80ce11
commit
84dcf6b8a8
1834 files changed
+11601
-10725
No files matched your search
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {setCachedDateOfBirthCollection} from '@app/api/instance/DateOfBirthCollectionCache';
|
||||
import {canUserAccessNsfwContent} from '@app/api/utils/AgeUtils';
|
||||
import {afterEach, describe, expect, it} from 'vitest';
|
||||
import {setCachedDateOfBirthCollection} from '../instance/DateOfBirthCollectionCache';
|
||||
import {canUserAccessNsfwContent} from './AgeUtils';
|
||||
|
||||
const ADULT_DATE_OF_BIRTH = '1990-01-01';
|
||||
const MINOR_DATE_OF_BIRTH = '2020-01-01';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {instanceCollectsDateOfBirth} from '../instance/DateOfBirthCollectionCache';
|
||||
import {instanceCollectsDateOfBirth} from '@app/api/instance/DateOfBirthCollectionCache';
|
||||
|
||||
export function calculateAge(
|
||||
dateOfBirth:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {requireIntegerInRange} from '@app/api/utils/IntegerOptions';
|
||||
import {getValidTimestamp} from '@app/api/utils/TimestampUtils';
|
||||
import {ms} from 'itty-time';
|
||||
import {requireIntegerInRange} from './IntegerOptions';
|
||||
import {getValidTimestamp} from './TimestampUtils';
|
||||
|
||||
export interface AttachmentDecayRules {
|
||||
minMb: number;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {Channel} from '../models/Channel';
|
||||
import type {Guild} from '../models/Guild';
|
||||
import type {GuildEmoji} from '../models/GuildEmoji';
|
||||
import type {GuildSticker} from '../models/GuildSticker';
|
||||
import {toIdString, toSortedIdArray} from './IdUtils';
|
||||
import type {Channel} from '@app/api/models/Channel';
|
||||
import type {Guild} from '@app/api/models/Guild';
|
||||
import type {GuildEmoji} from '@app/api/models/GuildEmoji';
|
||||
import type {GuildSticker} from '@app/api/models/GuildSticker';
|
||||
import {toIdString, toSortedIdArray} from '@app/api/utils/IdUtils';
|
||||
|
||||
export function serializeGuildForAudit(guild: Guild): Record<string, unknown> {
|
||||
return {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {EmojiID, GuildID, UserID, WebhookID} from '@app/api/BrandedTypes';
|
||||
import {createEmojiID} from '@app/api/BrandedTypes';
|
||||
import type {IGuildRepositoryAggregate} from '@app/api/guild/repositories/IGuildRepositoryAggregate';
|
||||
import type {LimitConfigService} from '@app/api/limits/LimitConfigService';
|
||||
import {resolveLimitSafe} from '@app/api/limits/LimitConfigUtils';
|
||||
import {createLimitMatchContext} from '@app/api/limits/LimitMatchContextBuilder';
|
||||
import type {GuildEmoji} from '@app/api/models/GuildEmoji';
|
||||
import type {IUserAccountRepository} from '@app/api/user/repositories/IUserAccountRepository';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
import type {EmojiID, GuildID, UserID, WebhookID} from '../BrandedTypes';
|
||||
import {createEmojiID} from '../BrandedTypes';
|
||||
import type {IGuildRepositoryAggregate} from '../guild/repositories/IGuildRepositoryAggregate';
|
||||
import type {LimitConfigService} from '../limits/LimitConfigService';
|
||||
import {resolveLimitSafe} from '../limits/LimitConfigUtils';
|
||||
import {createLimitMatchContext} from '../limits/LimitMatchContextBuilder';
|
||||
import type {GuildEmoji} from '../models/GuildEmoji';
|
||||
import type {IUserAccountRepository} from '../user/repositories/IUserAccountRepository';
|
||||
|
||||
type EmojiGuildRepository = Pick<IGuildRepositoryAggregate, 'getEmoji' | 'getEmojiById'>;
|
||||
type EmojiUserRepository = Pick<IUserAccountRepository, 'findUnique'>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Logger} from '@app/api/Logger';
|
||||
import {createHttpClient} from '@pkgs/http_client/src/HttpClient';
|
||||
import {formatUrlForDiagnostics} from '@pkgs/http_client/src/HttpClientDiagnostics';
|
||||
import {DEFAULT_MAX_REDIRECTS, normalizeMaxRedirects} from '@pkgs/http_client/src/HttpClientRequestInternals';
|
||||
@@ -11,7 +12,6 @@ import type {
|
||||
StreamResponse,
|
||||
} from '@pkgs/http_client/src/HttpClientTypes';
|
||||
import {createPublicInternetRequestUrlPolicy} from '@pkgs/http_client/src/PublicInternetRequestUrlPolicy';
|
||||
import {Logger} from '../Logger';
|
||||
|
||||
const requestUrlPolicy = createPublicInternetRequestUrlPolicy();
|
||||
const client: HttpClient = createHttpClient({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {isGuildMemberTimedOut} from '@app/api/guild/GuildModel';
|
||||
import {CommunicationDisabledError} from '@fluxer/errors/src/domains/moderation/CommunicationDisabledError';
|
||||
import type {GuildMemberResponse} from '@fluxer/schema/src/domains/guild/GuildMemberSchemas';
|
||||
import {isGuildMemberTimedOut} from '../guild/GuildModel';
|
||||
|
||||
export function assertGuildMemberCanCommunicate(member?: GuildMemberResponse | null): void {
|
||||
if (isGuildMemberTimedOut(member)) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {createUserID} from '@app/api/BrandedTypes';
|
||||
import {User} from '@app/api/models/User';
|
||||
import {checkGuildVerificationWithResponse} from '@app/api/utils/GuildVerificationUtils';
|
||||
import {GuildFeatures, GuildVerificationLevel} from '@fluxer/constants/src/GuildConstants';
|
||||
import {ProfileFieldPrivacyFlags} from '@fluxer/constants/src/UserConstants';
|
||||
import {GuildEmailVerificationRequiredError} from '@fluxer/errors/src/domains/auth/EmailVerificationRequiredError';
|
||||
@@ -7,9 +10,6 @@ import {GuildPhoneVerificationRequiredError} from '@fluxer/errors/src/domains/au
|
||||
import type {GuildMemberResponse} from '@fluxer/schema/src/domains/guild/GuildMemberSchemas';
|
||||
import type {GuildResponse} from '@fluxer/schema/src/domains/guild/GuildResponseSchemas';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {createUserID} from '../BrandedTypes';
|
||||
import {User} from '../models/User';
|
||||
import {checkGuildVerificationWithResponse} from './GuildVerificationUtils';
|
||||
|
||||
const TEST_USER_ID = createUserID(175928847299117063n);
|
||||
const TEST_OWNER_ID = createUserID(275928847299117063n);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {createRoleIDSet, createUserID, type RoleID, type UserID} from '@app/api/BrandedTypes';
|
||||
import type {Guild} from '@app/api/models/Guild';
|
||||
import type {GuildMember} from '@app/api/models/GuildMember';
|
||||
import type {User} from '@app/api/models/User';
|
||||
import {
|
||||
GuildFeatures,
|
||||
GuildVerificationLevel,
|
||||
@@ -13,10 +17,6 @@ import type {GuildMemberResponse} from '@fluxer/schema/src/domains/guild/GuildMe
|
||||
import type {GuildResponse} from '@fluxer/schema/src/domains/guild/GuildResponseSchemas';
|
||||
import {snowflakeToDate} from '@fluxer/snowflake/src/Snowflake';
|
||||
import {ms} from 'itty-time';
|
||||
import {createRoleIDSet, createUserID, type RoleID, type UserID} from '../BrandedTypes';
|
||||
import type {Guild} from '../models/Guild';
|
||||
import type {GuildMember} from '../models/GuildMember';
|
||||
import type {User} from '../models/User';
|
||||
|
||||
interface VerificationParams {
|
||||
user: User;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {ChannelID, EmojiID, GuildID, RoleID, StickerID, UserID} from '../BrandedTypes';
|
||||
import type {ChannelID, EmojiID, GuildID, RoleID, StickerID, UserID} from '@app/api/BrandedTypes';
|
||||
|
||||
export function toIdString(
|
||||
value: GuildID | ChannelID | RoleID | UserID | EmojiID | StickerID | bigint | string | null | undefined,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Config} from '../Config';
|
||||
import * as RegexUtils from './RegexUtils';
|
||||
import {Config} from '@app/api/Config';
|
||||
import * as RegexUtils from '@app/api/utils/RegexUtils';
|
||||
|
||||
let _invitePattern: RegExp | null = null;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import dns from 'node:dns';
|
||||
import {Config} from '@app/api/Config';
|
||||
import {extractClientIp} from '@fluxer/ip_utils/src/ClientIp';
|
||||
import type {ICacheService} from '@pkgs/cache/src/ICacheService';
|
||||
import type {GeoipResult} from '@pkgs/geoip/src/GeoipLookup';
|
||||
import {formatGeoipLocation, lookupGeoipByIp} from '@pkgs/geoip/src/GeoipLookup';
|
||||
import {seconds} from 'itty-time';
|
||||
import {Config} from '../Config';
|
||||
|
||||
const REVERSE_DNS_CACHE_TTL_SECONDS = seconds('1 day');
|
||||
const REVERSE_DNS_CACHE_PREFIX = 'reverse-dns:';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {Guild} from '../models/Guild';
|
||||
import type {Guild} from '@app/api/models/Guild';
|
||||
|
||||
export const DISQUALIFIED_MUTUAL_GUILD_DM_ACCESS_GUILD_IDS = [
|
||||
1427764882469228556n,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Config} from '@app/api/Config';
|
||||
import argon2 from 'argon2';
|
||||
import {Config} from '../Config';
|
||||
|
||||
const TEST_ARGON2_OPTIONS: argon2.Options = {
|
||||
memoryCost: 1024,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {ChannelID, GuildID, UserID} from '@app/api/BrandedTypes';
|
||||
import type {IGatewayService} from '@app/api/infrastructure/IGatewayService';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
import {MissingPermissionsError} from '@fluxer/errors/src/domains/core/MissingPermissionsError';
|
||||
import type {ChannelID, GuildID, UserID} from '../BrandedTypes';
|
||||
import type {IGatewayService} from '../infrastructure/IGatewayService';
|
||||
|
||||
interface PermissionsDiff {
|
||||
added: Array<string>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Config} from '@app/api/Config';
|
||||
import type {HonoEnv} from '@app/api/types/HonoEnv';
|
||||
import {extractClientIp, MissingClientIpError, resolveClientIpHeaderName} from '@fluxer/ip_utils/src/ClientIp';
|
||||
import type {Context} from 'hono';
|
||||
import {Config} from '../Config';
|
||||
import type {HonoEnv} from '../types/HonoEnv';
|
||||
|
||||
export interface ClientIpResolution {
|
||||
trustClientIpHeader: boolean;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {parseJsonPreservingLargeIntegers} from '@app/api/utils/LosslessJsonParser';
|
||||
import {ValidationErrorCodes} from '@fluxer/constants/src/ValidationErrorCodes';
|
||||
import {InputValidationError} from '@fluxer/errors/src/domains/core/InputValidationError';
|
||||
import type {HonoRequest} from 'hono';
|
||||
import {parseJsonPreservingLargeIntegers} from './LosslessJsonParser';
|
||||
|
||||
interface RequestJsonBody {
|
||||
parsed: boolean;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {Logger} from '@app/api/Logger';
|
||||
import {parseJsonRecord} from '@app/api/utils/JsonBoundaryUtils';
|
||||
import Bowser from 'bowser';
|
||||
import {Logger} from '../Logger';
|
||||
import {parseJsonRecord} from './JsonBoundaryUtils';
|
||||
|
||||
export type SessionDeviceClass = 'mobile' | 'desktop';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {createHash} from 'node:crypto';
|
||||
import {Config} from '@app/api/Config';
|
||||
import {Logger} from '@app/api/Logger';
|
||||
import * as InviteUtils from '@app/api/utils/InviteUtils';
|
||||
import {URL_REGEX} from '@fluxer/constants/src/Core';
|
||||
import * as idna from 'idna-uts46-hx';
|
||||
import {Config} from '../Config';
|
||||
import {Logger} from '../Logger';
|
||||
import * as InviteUtils from './InviteUtils';
|
||||
|
||||
const MARKETING_PATH_PREFIXES = ['/channels/', '/theme/'];
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {GuildID, UserID} from '@app/api/BrandedTypes';
|
||||
import type {IGuildRepositoryAggregate} from '@app/api/guild/repositories/IGuildRepositoryAggregate';
|
||||
import type {Guild} from '@app/api/models/Guild';
|
||||
import type {Relationship} from '@app/api/models/Relationship';
|
||||
import type {IUserRepository} from '@app/api/user/IUserRepository';
|
||||
import {hasMutualGuildForDmAccess} from '@app/api/utils/MutualGuildDmAccess';
|
||||
import {
|
||||
FriendSourceFlags,
|
||||
GroupDmAddPermissionFlags,
|
||||
@@ -8,12 +14,6 @@ import {
|
||||
} from '@fluxer/constants/src/UserConstants';
|
||||
import {MissingAccessError} from '@fluxer/errors/src/domains/core/MissingAccessError';
|
||||
import {FriendRequestBlockedError} from '@fluxer/errors/src/domains/user/FriendRequestBlockedError';
|
||||
import type {GuildID, UserID} from '../BrandedTypes';
|
||||
import type {IGuildRepositoryAggregate} from '../guild/repositories/IGuildRepositoryAggregate';
|
||||
import type {Guild} from '../models/Guild';
|
||||
import type {Relationship} from '../models/Relationship';
|
||||
import type {IUserRepository} from '../user/IUserRepository';
|
||||
import {hasMutualGuildForDmAccess} from './MutualGuildDmAccess';
|
||||
|
||||
type UserPermissionRepository = Pick<IUserRepository, 'findSettings' | 'listRelationships' | 'getRelationship'>;
|
||||
type GuildPermissionRepository = Pick<IGuildRepositoryAggregate, 'listUserGuilds'>;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import {randomInt} from 'node:crypto';
|
||||
import {readFileSync} from 'node:fs';
|
||||
import {resolveAssetPath} from '@app/api/utils/AssetPaths';
|
||||
import {UsernameType} from '@fluxer/schema/src/primitives/UserValidators';
|
||||
import {resolveAssetPath} from './AssetPaths';
|
||||
|
||||
const scales = readFileSync(resolveAssetPath('words', 'scales.txt'), 'utf-8').trim().split('\n').filter(Boolean);
|
||||
const tails = readFileSync(resolveAssetPath('words', 'tails.txt'), 'utf-8').trim().split('\n').filter(Boolean);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {chunkArray} from '@app/api/utils/ArrayUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {chunkArray} from '../ArrayUtils';
|
||||
|
||||
describe('chunkArray', () => {
|
||||
it.each([
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {mapWithConcurrency} from '@app/api/utils/ConcurrencyUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {mapWithConcurrency} from '../ConcurrencyUtils';
|
||||
|
||||
describe('mapWithConcurrency', () => {
|
||||
it('limits in-flight work and preserves input order when later items finish first', async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {getCurrency, getCurrencyPreferences, getGiftCurrencyPreferences} from '@app/api/utils/CurrencyUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {getCurrency, getCurrencyPreferences, getGiftCurrencyPreferences} from '../CurrencyUtils';
|
||||
|
||||
describe('getCurrency', () => {
|
||||
describe('returns USD for non-EEA countries', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {decodeHTMLEntities, htmlToMarkdown, stripHtmlTags} from '@app/api/utils/DOMUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {decodeHTMLEntities, htmlToMarkdown, stripHtmlTags} from '../DOMUtils';
|
||||
|
||||
describe('decodeHTMLEntities', () => {
|
||||
it('returns empty string for null input', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import * as FetchUtils from '@app/api/utils/FetchUtils';
|
||||
import {describe, expect, it, vi} from 'vitest';
|
||||
import * as FetchUtils from '../FetchUtils';
|
||||
|
||||
function createStream(chunks: Array<string>): ReadableStream<Uint8Array> {
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {calculateDistance, parseCoordinate} from '@app/api/utils/GeoUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {calculateDistance, parseCoordinate} from '../GeoUtils';
|
||||
|
||||
describe('calculateDistance', () => {
|
||||
it('returns 0 for identical coordinates', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {toIdString, toSortedIdArray} from '@app/api/utils/IdUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {toIdString, toSortedIdArray} from '../IdUtils';
|
||||
|
||||
describe('toIdString', () => {
|
||||
it.each([
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {isValidIpOrRange, parseIpBanEntry, tryParseSingleIp} from '@app/api/utils/IpRangeUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {isValidIpOrRange, parseIpBanEntry, tryParseSingleIp} from '../IpRangeUtils';
|
||||
|
||||
describe('parseIpBanEntry', () => {
|
||||
describe('single IPv4 addresses', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {coerceUnsafeIntegersToStrings, parseJsonPreservingLargeIntegers} from '@app/api/utils/LosslessJsonParser';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {coerceUnsafeIntegersToStrings, parseJsonPreservingLargeIntegers} from '../LosslessJsonParser';
|
||||
|
||||
describe('parseJsonPreservingLargeIntegers', () => {
|
||||
it('keeps safe integers as numbers', () => {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {GuildFeatures} from '@fluxer/constants/src/GuildConstants';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {createGuildID, createUserID} from '../../BrandedTypes';
|
||||
import type {GuildRow} from '../../database/types/GuildTypes';
|
||||
import {Guild} from '../../models/Guild';
|
||||
import {createGuildID, createUserID} from '@app/api/BrandedTypes';
|
||||
import type {GuildRow} from '@app/api/database/types/GuildTypes';
|
||||
import {Guild} from '@app/api/models/Guild';
|
||||
import {
|
||||
DISQUALIFIED_MUTUAL_GUILD_DM_ACCESS_GUILD_IDS,
|
||||
getMutualGuildsForDmAccess,
|
||||
guildQualifiesForMutualGuildDmAccess,
|
||||
} from '../MutualGuildDmAccess';
|
||||
} from '@app/api/utils/MutualGuildDmAccess';
|
||||
import {GuildFeatures} from '@fluxer/constants/src/GuildConstants';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
function createGuild(overrides: Partial<GuildRow> = {}): Guild {
|
||||
return new Guild({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {escapeRegex} from '@app/api/utils/RegexUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {escapeRegex} from '../RegexUtils';
|
||||
|
||||
describe('escapeRegex', () => {
|
||||
it('escapes hyphen', () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type {HonoEnv} from '@app/api/types/HonoEnv';
|
||||
import {getRequestClientIp, requireRequestClientIp, resolveClientIpWithOptions} from '@app/api/utils/RequestClientIp';
|
||||
import {AppErrorHandler} from '@fluxer/errors/src/domains/core/ErrorHandlers';
|
||||
import {MissingClientIpError} from '@fluxer/ip_utils/src/ClientIp';
|
||||
import {Hono} from 'hono';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import type {HonoEnv} from '../../types/HonoEnv';
|
||||
import {getRequestClientIp, requireRequestClientIp, resolveClientIpWithOptions} from '../RequestClientIp';
|
||||
|
||||
interface CountingRequest {
|
||||
request: Request;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {
|
||||
isFluxerNativeUserAgent,
|
||||
parseReportedClientOs,
|
||||
resolveSessionClientInfo,
|
||||
type SessionClientInfo,
|
||||
} from '../SessionClientIdentity';
|
||||
} from '@app/api/utils/SessionClientIdentity';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
const ELECTRON_MAC_UA =
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) FluxerStable/2026.614.83512 Chrome/126.0.0.0 Electron/31.0.0 Safari/537.36';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {hasVisibleContent, parseString} from '@app/api/utils/StringUtils';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {hasVisibleContent, parseString} from '../StringUtils';
|
||||
|
||||
describe('parseString', () => {
|
||||
it.each([
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {canonicalizeUrl, extractUrlCandidates} from '@app/api/utils/UrlNormalizer';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {canonicalizeUrl, extractUrlCandidates} from '../UrlNormalizer';
|
||||
|
||||
describe('canonicalizeUrl', () => {
|
||||
it('lowercases scheme and host', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {sanitizeOptionalAbsoluteUrl, sanitizeOptionalAbsoluteUrlOrNull} from '@app/api/utils/UrlSanitizer';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {sanitizeOptionalAbsoluteUrl, sanitizeOptionalAbsoluteUrlOrNull} from '../UrlSanitizer';
|
||||
|
||||
describe('sanitizeOptionalAbsoluteUrl', () => {
|
||||
it('returns undefined for nullish values', () => {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {
|
||||
applyProtectedOverwriteBits,
|
||||
applyProtectedRolePermissions,
|
||||
parseClientFeaturesHeader,
|
||||
} from '@app/api/utils/featureUtils';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {applyProtectedOverwriteBits, applyProtectedRolePermissions, parseClientFeaturesHeader} from '../featureUtils';
|
||||
|
||||
const VCM = Permissions.VIEW_CHANNEL_MEMBERS;
|
||||
const FEATURE = 'view_channel_members_permission';
|
||||
|
||||
Reference in new issue
Block a user