Normalize imports, typings and formatting
Reorder and normalize imports, add missing type imports, and fix whitespace/formatting across multiple files. Notable updates: eslint.config.ts import ordering; core bridge APIs (group-album, misc, web) now import Json types; tests/highway pipeline import ordering and added type imports; protocol changes (element-builder, highway client/pipeline) reorganized imports and added proto type imports; many oidb service modules moved protobuf encode/decode imports for consistency; web group modules (album, essence, honor, notice, request-util) reordered imports, adjusted typings/indentation, and small whitespace fixes. These edits are stylistic and typing improvements and should not change runtime behavior.
This commit is contained in:
1 parent
80ee12ecc2
commit
456086599c
23 files changed
+83
-83
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import { RequestUtil, cookieToString, getBknFromCookie } from './request-util';
|
||||
import { createHash } from 'crypto';
|
||||
import { statSync, createReadStream, writeFileSync, unlinkSync } from 'fs';
|
||||
import { basename, join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import type { JsonValue } from '@snowluma/common/json';
|
||||
import { createHash } from 'crypto';
|
||||
import { createReadStream, statSync, unlinkSync, writeFileSync } from 'fs';
|
||||
import { tmpdir } from 'os';
|
||||
import { basename, join } from 'path';
|
||||
import { RequestUtil, cookieToString, getBknFromCookie } from './request-util';
|
||||
|
||||
// 群相册信息
|
||||
export interface GroupAlbumInfo {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { RequestUtil, cookieToString, getBknFromCookie } from './request-util';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import type { JsonObject } from '@snowluma/common/json';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import { RequestUtil, cookieToString, getBknFromCookie } from './request-util';
|
||||
|
||||
const log = createLogger('Bridge.Web');
|
||||
|
||||
// 定义接口返回类型
|
||||
export interface GroupEssenceMsgRet {
|
||||
retcode: number;
|
||||
data: {
|
||||
is_end: boolean;
|
||||
retcode: number;
|
||||
data: {
|
||||
is_end: boolean;
|
||||
msg_list: JsonObject[]; // 具体结构视需要补充
|
||||
[key: string]: JsonObject[] | boolean | string | number | null;
|
||||
};
|
||||
};
|
||||
[key: string]: JsonObject | JsonObject[] | boolean | string | number | null;
|
||||
}
|
||||
|
||||
@@ -69,4 +69,4 @@ export async function getGroupEssenceMsgAll(
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RequestUtil, cookieToString } from './request-util';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import { RequestUtil, cookieToString } from './request-util';
|
||||
|
||||
const log = createLogger('Bridge.Web');
|
||||
|
||||
@@ -24,11 +24,11 @@ interface HonorInitialState {
|
||||
}
|
||||
|
||||
export enum WebHonorType {
|
||||
TALKATIVE = 'talkative',
|
||||
PERFORMER = 'performer',
|
||||
LEGEND = 'legend',
|
||||
EMOTION = 'emotion',
|
||||
ALL = 'all',
|
||||
TALKATIVE = 'talkative',
|
||||
PERFORMER = 'performer',
|
||||
LEGEND = 'legend',
|
||||
EMOTION = 'emotion',
|
||||
ALL = 'all',
|
||||
}
|
||||
|
||||
|
||||
@@ -70,4 +70,4 @@ export async function getHonorListWebAPI(cookieObject: Record<string, string>, g
|
||||
groupCode, type, e instanceof Error ? (e.stack ?? e.message) : String(e));
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,40 @@
|
||||
import { RequestUtil, cookieToString } from './request-util';
|
||||
import https from 'node:https';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import type { JsonValue } from '@snowluma/common/json';
|
||||
import { createLogger } from '@snowluma/common/logger';
|
||||
import https from 'node:https';
|
||||
import { RequestUtil, cookieToString } from './request-util';
|
||||
|
||||
const log = createLogger('Bridge.Web');
|
||||
|
||||
export interface SetNoticeRetSuccess {
|
||||
ec?: number;
|
||||
em?: string;
|
||||
ec?: number;
|
||||
em?: string;
|
||||
[key: string]: JsonValue | undefined;
|
||||
}
|
||||
|
||||
export interface UploadImageRetSuccess {
|
||||
ec?: number;
|
||||
id?: string;
|
||||
ec?: number;
|
||||
id?: string;
|
||||
[key: string]: JsonValue | undefined;
|
||||
}
|
||||
|
||||
export interface WebApiGroupNoticeFeed {
|
||||
fid: string;
|
||||
u: number;
|
||||
pubt: number;
|
||||
msg: {
|
||||
text: string;
|
||||
pics?: Array<{ id: string; w: number; h: number }>;
|
||||
};
|
||||
settings: JsonValue;
|
||||
read_num: number;
|
||||
[key: string]: JsonValue;
|
||||
fid: string;
|
||||
u: number;
|
||||
pubt: number;
|
||||
msg: {
|
||||
text: string;
|
||||
pics?: Array<{ id: string; w: number; h: number }>;
|
||||
};
|
||||
settings: JsonValue;
|
||||
read_num: number;
|
||||
[key: string]: JsonValue;
|
||||
}
|
||||
|
||||
export interface WebApiGroupNoticeRet {
|
||||
ec: number;
|
||||
em?: string;
|
||||
feeds?: Record<string, WebApiGroupNoticeFeed>;
|
||||
[key: string]: JsonValue | Record<string, WebApiGroupNoticeFeed> | undefined;
|
||||
ec: number;
|
||||
em?: string;
|
||||
feeds?: Record<string, WebApiGroupNoticeFeed>;
|
||||
[key: string]: JsonValue | Record<string, WebApiGroupNoticeFeed> | undefined;
|
||||
}
|
||||
|
||||
export function calculateBkn(key: string): string {
|
||||
@@ -174,7 +174,7 @@ export async function uploadGroupNoticeImage(
|
||||
imageBuffer: Buffer
|
||||
): Promise<{ id: string; width: number; height: number } | undefined> {
|
||||
try {
|
||||
const bkn = calculateBkn(cookieObject['skey']);
|
||||
const bkn = calculateBkn(cookieObject['skey']);
|
||||
const boundary = `-----------------------------${Date.now()}`;
|
||||
|
||||
const parts: Buffer[] = [];
|
||||
@@ -271,4 +271,4 @@ export async function deleteGroupNotice(
|
||||
log.warn('deleteGroupNotice failed (group=%s fid=%s): %s', groupCode, fid, e instanceof Error ? (e.stack ?? e.message) : String(e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import https from 'node:https';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
|
||||
type RequestBody = string | Buffer | Uint8Array | Record<string, unknown> | undefined;
|
||||
|
||||
@@ -53,8 +53,8 @@ export class RequestUtil {
|
||||
}
|
||||
|
||||
static async HttpGetJson<T>(url: string, method: string = 'GET', data?: RequestBody, headers: {
|
||||
[key: string]: string;
|
||||
} = {}, isJsonRet: boolean = true, isArgJson: boolean = true, maxRedirects: number = 5): Promise<T> {
|
||||
[key: string]: string;
|
||||
} = {}, isJsonRet: boolean = true, isArgJson: boolean = true, maxRedirects: number = 5): Promise<T> {
|
||||
const option = new URL(url);
|
||||
const protocol = url.startsWith('https://') ? https : http;
|
||||
const options = {
|
||||
|
||||
Reference in new issue
Block a user