koishi-plugin-xlon 1.1.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.d.ts CHANGED
@@ -8,8 +8,20 @@ export interface SubscriptionItem {
8
8
  blacklist: string[];
9
9
  }
10
10
  export interface Config {
11
- cookies: string;
11
+ /** Puppeteer 回退使用的完整 Cookie 字符串 */
12
+ cookie: string;
12
13
  updateInterval: number;
14
+ maxUpdateInterval: number;
15
+ requestGap: number;
16
+ maxBackoff: number;
17
+ browserFallback: boolean;
18
+ maxPostsPerPoll: number;
19
+ maxDeliveryAttempts: number;
20
+ deliveryRetentionDays: number;
21
+ checkAuthority: number;
22
+ commandCooldown: number;
23
+ maxCommandConcurrency: number;
24
+ maxMediaSize: number;
13
25
  messagePrefix: string;
14
26
  screenshot: boolean;
15
27
  translateEnabled: boolean;
@@ -1,2 +1,4 @@
1
1
  /** 对外请求统一使用的 User-Agent */
2
2
  export declare const UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36";
3
+ /** X 用户名不区分大小写;内部状态和路由统一使用此键。 */
4
+ export declare function normalizeUsernameKey(input: string): string;
package/lib/db/model.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { Context } from 'koishi';
2
- import { XlonRecord } from '../types';
2
+ import { XlonDeliveryRecord, XlonSubscriptionState } from '../types';
3
3
  declare module 'koishi' {
4
4
  interface Tables {
5
- xlon: XlonRecord;
5
+ xlon_subscription_state: XlonSubscriptionState;
6
+ xlon_delivery: XlonDeliveryRecord;
6
7
  }
7
8
  }
8
9
  export declare function extendDatabase(ctx: Context): void;
package/lib/db/repo.d.ts CHANGED
@@ -1,9 +1,21 @@
1
1
  import { Context } from 'koishi';
2
- import { XlonRecord } from '../types';
3
- export declare class XlonRepo {
2
+ import { DeliveryStatus, XlonDeliveryRecord, XlonSubscriptionState } from '../types';
3
+ export declare class SubscriptionStateRepo {
4
4
  private ctx;
5
5
  constructor(ctx: Context);
6
- get(id: string): Promise<XlonRecord | null>;
7
- upsert(record: XlonRecord): Promise<void>;
8
- listIds(): Promise<string[]>;
6
+ get(id: string): Promise<XlonSubscriptionState | null>;
7
+ upsert(record: XlonSubscriptionState): Promise<void>;
8
+ removeMissing(ids: string[]): Promise<void>;
9
+ }
10
+ export declare class DeliveryRepo {
11
+ private ctx;
12
+ constructor(ctx: Context);
13
+ enqueue(records: XlonDeliveryRecord[]): Promise<void>;
14
+ listPending(now?: Date): Promise<XlonDeliveryRecord[]>;
15
+ mark(key: string, status: DeliveryStatus, patch?: Partial<XlonDeliveryRecord>): Promise<void>;
16
+ cancelMissing(subscriptions: Array<{
17
+ id: string;
18
+ targets: string[];
19
+ }>): Promise<void>;
20
+ cleanup(before: Date): Promise<void>;
9
21
  }
@@ -1,3 +1,6 @@
1
1
  import { Context, Session } from 'koishi';
2
2
  import { Config } from '../config';
3
+ export declare function isXDomain(urlStr: string): boolean;
4
+ /** 只请求 t.co 自身,读取 Location 但绝不访问重定向后的目标。 */
5
+ export declare function expandShortLink(url: string): Promise<string | null>;
3
6
  export declare function registerLinkDetector(ctx: Context, config: Config, handler: (session: Session, url: string) => Promise<void>): void;