safelink updates regarding feedback

This commit is contained in:
BlueSkiesAndGreenPastures
2025-06-20 12:24:59 -05:00
parent 086256cd9a
commit bc1573cf47
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ async function main() {
const link = await LinkService.create(cfg)
if (cfg.service.safelink === 1) {
if (cfg.service.safelinkEnabled) {
cfg.eventCache.adaptiveFetchAndUpdate()
}
+5 -5
View File
@@ -1,4 +1,4 @@
import {envInt, envList, envStr} from '@atproto/common'
import {envBool, envInt, envList, envStr} from '@atproto/common'
// import { type EventCache, eventCache } from '../cache/cache.js'
import {EventCache} from './cache/cache.js'
@@ -14,7 +14,7 @@ export type ServiceConfig = {
version?: string
hostnames: string[]
appHostname: string
safelink: number
safelinkEnabled: boolean
ozoneUrl?: string
ozoneAgentHandle?: string
ozoneAgentPass?: string
@@ -44,7 +44,7 @@ export type Environment = {
dbPostgresPoolSize?: number
dbPostgresPoolMaxUses?: number
dbPostgresPoolIdleTimeoutMs?: number
safelink?: number
safelinkEnabled?: boolean
ozoneUrl?: string
ozoneAgentHandle?: string
ozoneAgentPass?: string
@@ -64,7 +64,7 @@ export const readEnv = (): Environment => {
dbPostgresPoolIdleTimeoutMs: envInt(
'LINK_DB_POSTGRES_POOL_IDLE_TIMEOUT_MS',
),
safelink: envInt('SAFELINK'),
safelinkEnabled: envBool('SAFELINK_ENABLED'),
ozoneUrl: envStr('OZONE_URL'),
ozoneAgentHandle: envStr('OZONE_AGENT_HANDLE'),
ozoneAgentPass: envStr('OZONE_AGENT_PASS'),
@@ -77,7 +77,7 @@ export const envToCfg = (env: Environment): Config => {
version: env.version,
hostnames: env.hostnames,
appHostname: env.appHostname || 'bsky.app',
safelink: env.safelink || 0,
safelinkEnabled: env.safelinkEnabled || false,
ozoneUrl: env.ozoneUrl || undefined,
ozoneAgentHandle: env.ozoneAgentHandle || undefined,
ozoneAgentPass: env.ozoneAgentPass || undefined,
+1 -1
View File
@@ -45,7 +45,7 @@ export default function (ctx: AppContext, app: Express) {
res.type('html')
res.status(302)
if (ctx.cfg.service.safelink) {
if (ctx.cfg.service.safelinkEnabled) {
const rulePresent: ToolsOzoneSafelinkDefs.Event | undefined =
ctx.cfg.eventCache.smartGet(link)
+1 -1
View File
@@ -17,7 +17,7 @@ describe('link service', async () => {
appHostname: 'test.bsky.app',
dbPostgresSchema: 'link_test',
dbPostgresUrl: process.env.DB_POSTGRES_URL,
safelink: 1,
safelinkEnabled: true,
ozoneUrl: 'http://localhost:2583',
ozoneAgentHandle: 'mod-authority.test',
ozoneAgentPass: 'hunter2',