use types from ozone
This commit is contained in:
Vendored
+3
-2
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
AtpAgent,
|
||||
CredentialSession,
|
||||
type ToolsOzoneSafelinkDefs,
|
||||
type ToolsOzoneSafelinkQueryEvents,
|
||||
} from '@atproto/api'
|
||||
import {HOUR} from '@atproto/common'
|
||||
@@ -8,7 +9,7 @@ import {LRUCache} from 'lru-cache'
|
||||
|
||||
import {type ServiceConfig} from '../config.js'
|
||||
import type Database from '../db/index.js'
|
||||
import {type RulePatternType, type SafelinkRule} from '../db/schema.js'
|
||||
import {type SafelinkRule} from '../db/schema.js'
|
||||
import {redirectLogger} from '../logger.js'
|
||||
|
||||
const SAFELINK_MIN_FETCH_INTERVAL = 1_000
|
||||
@@ -93,7 +94,7 @@ export class SafelinkClient {
|
||||
private async getRule(
|
||||
db: Database,
|
||||
url: string,
|
||||
pattern: RulePatternType,
|
||||
pattern: ToolsOzoneSafelinkDefs.PatternType,
|
||||
): Promise<SafelinkRule> {
|
||||
return db.db
|
||||
.selectFrom('safelink_rule')
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {type ToolsOzoneSafelinkDefs} from '@atproto/api'
|
||||
import {type Selectable} from 'kysely'
|
||||
|
||||
export type DbSchema = {
|
||||
@@ -16,27 +17,13 @@ export enum LinkType {
|
||||
StarterPack = 1,
|
||||
}
|
||||
|
||||
export type RuleEventType =
|
||||
| 'addRule'
|
||||
| 'updateRule'
|
||||
| 'removeRule'
|
||||
| (string & {})
|
||||
export type RulePatternType = 'domain' | 'url' | (string & {})
|
||||
export type RuleActionType = 'block' | 'warn' | 'whitelist' | (string & {})
|
||||
export type RuleReasonType =
|
||||
| 'csam'
|
||||
| 'spam'
|
||||
| 'phishing'
|
||||
| 'none'
|
||||
| (string & {})
|
||||
|
||||
export interface SafelinkRule {
|
||||
id: number
|
||||
eventType: RuleEventType
|
||||
eventType: ToolsOzoneSafelinkDefs.EventType
|
||||
url: string
|
||||
pattern: RulePatternType
|
||||
action: RuleActionType
|
||||
reason: RuleReasonType
|
||||
pattern: ToolsOzoneSafelinkDefs.PatternType
|
||||
action: ToolsOzoneSafelinkDefs.ActionType
|
||||
reason: ToolsOzoneSafelinkDefs.ReasonType
|
||||
createdBy: string
|
||||
createdAt: string
|
||||
comment?: string
|
||||
|
||||
Reference in New Issue
Block a user