safelink updates regarding feedback
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ async function main() {
|
|||||||
|
|
||||||
const link = await LinkService.create(cfg)
|
const link = await LinkService.create(cfg)
|
||||||
|
|
||||||
if (cfg.service.safelink === 1) {
|
if (cfg.service.safelinkEnabled) {
|
||||||
cfg.eventCache.adaptiveFetchAndUpdate()
|
cfg.eventCache.adaptiveFetchAndUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 { type EventCache, eventCache } from '../cache/cache.js'
|
||||||
import {EventCache} from './cache/cache.js'
|
import {EventCache} from './cache/cache.js'
|
||||||
@@ -14,7 +14,7 @@ export type ServiceConfig = {
|
|||||||
version?: string
|
version?: string
|
||||||
hostnames: string[]
|
hostnames: string[]
|
||||||
appHostname: string
|
appHostname: string
|
||||||
safelink: number
|
safelinkEnabled: boolean
|
||||||
ozoneUrl?: string
|
ozoneUrl?: string
|
||||||
ozoneAgentHandle?: string
|
ozoneAgentHandle?: string
|
||||||
ozoneAgentPass?: string
|
ozoneAgentPass?: string
|
||||||
@@ -44,7 +44,7 @@ export type Environment = {
|
|||||||
dbPostgresPoolSize?: number
|
dbPostgresPoolSize?: number
|
||||||
dbPostgresPoolMaxUses?: number
|
dbPostgresPoolMaxUses?: number
|
||||||
dbPostgresPoolIdleTimeoutMs?: number
|
dbPostgresPoolIdleTimeoutMs?: number
|
||||||
safelink?: number
|
safelinkEnabled?: boolean
|
||||||
ozoneUrl?: string
|
ozoneUrl?: string
|
||||||
ozoneAgentHandle?: string
|
ozoneAgentHandle?: string
|
||||||
ozoneAgentPass?: string
|
ozoneAgentPass?: string
|
||||||
@@ -64,7 +64,7 @@ export const readEnv = (): Environment => {
|
|||||||
dbPostgresPoolIdleTimeoutMs: envInt(
|
dbPostgresPoolIdleTimeoutMs: envInt(
|
||||||
'LINK_DB_POSTGRES_POOL_IDLE_TIMEOUT_MS',
|
'LINK_DB_POSTGRES_POOL_IDLE_TIMEOUT_MS',
|
||||||
),
|
),
|
||||||
safelink: envInt('SAFELINK'),
|
safelinkEnabled: envBool('SAFELINK_ENABLED'),
|
||||||
ozoneUrl: envStr('OZONE_URL'),
|
ozoneUrl: envStr('OZONE_URL'),
|
||||||
ozoneAgentHandle: envStr('OZONE_AGENT_HANDLE'),
|
ozoneAgentHandle: envStr('OZONE_AGENT_HANDLE'),
|
||||||
ozoneAgentPass: envStr('OZONE_AGENT_PASS'),
|
ozoneAgentPass: envStr('OZONE_AGENT_PASS'),
|
||||||
@@ -77,7 +77,7 @@ export const envToCfg = (env: Environment): Config => {
|
|||||||
version: env.version,
|
version: env.version,
|
||||||
hostnames: env.hostnames,
|
hostnames: env.hostnames,
|
||||||
appHostname: env.appHostname || 'bsky.app',
|
appHostname: env.appHostname || 'bsky.app',
|
||||||
safelink: env.safelink || 0,
|
safelinkEnabled: env.safelinkEnabled || false,
|
||||||
ozoneUrl: env.ozoneUrl || undefined,
|
ozoneUrl: env.ozoneUrl || undefined,
|
||||||
ozoneAgentHandle: env.ozoneAgentHandle || undefined,
|
ozoneAgentHandle: env.ozoneAgentHandle || undefined,
|
||||||
ozoneAgentPass: env.ozoneAgentPass || undefined,
|
ozoneAgentPass: env.ozoneAgentPass || undefined,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function (ctx: AppContext, app: Express) {
|
|||||||
res.type('html')
|
res.type('html')
|
||||||
res.status(302)
|
res.status(302)
|
||||||
|
|
||||||
if (ctx.cfg.service.safelink) {
|
if (ctx.cfg.service.safelinkEnabled) {
|
||||||
const rulePresent: ToolsOzoneSafelinkDefs.Event | undefined =
|
const rulePresent: ToolsOzoneSafelinkDefs.Event | undefined =
|
||||||
ctx.cfg.eventCache.smartGet(link)
|
ctx.cfg.eventCache.smartGet(link)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe('link service', async () => {
|
|||||||
appHostname: 'test.bsky.app',
|
appHostname: 'test.bsky.app',
|
||||||
dbPostgresSchema: 'link_test',
|
dbPostgresSchema: 'link_test',
|
||||||
dbPostgresUrl: process.env.DB_POSTGRES_URL,
|
dbPostgresUrl: process.env.DB_POSTGRES_URL,
|
||||||
safelink: 1,
|
safelinkEnabled: true,
|
||||||
ozoneUrl: 'http://localhost:2583',
|
ozoneUrl: 'http://localhost:2583',
|
||||||
ozoneAgentHandle: 'mod-authority.test',
|
ozoneAgentHandle: 'mod-authority.test',
|
||||||
ozoneAgentPass: 'hunter2',
|
ozoneAgentPass: 'hunter2',
|
||||||
|
|||||||
Reference in New Issue
Block a user