dna-api 0.2.7 → 0.2.9
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/dist/api.test.d.ts +1 -0
- package/dist/index.d.ts +146 -9
- package/dist/index.js +3 -3
- package/dist/index.js.map +3 -3
- package/package.json +48 -48
- package/src/api.test.ts +12 -0
- package/src/index.ts +191 -17
- package/tsconfig.json +103 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,28 @@ export declare class DNAAPI {
|
|
|
29
29
|
* @returns RSA公钥(base64)
|
|
30
30
|
*/
|
|
31
31
|
getRsaPublicKey(): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* 获取通用配置
|
|
34
|
+
*/
|
|
35
|
+
getCommonConfig(): Promise<DNAApiResponse<DNACommonConfigRes>>;
|
|
36
|
+
/**
|
|
37
|
+
* 获取地图标点分类
|
|
38
|
+
*/
|
|
39
|
+
getMapMatterCategorizeOptions(): Promise<DNAApiResponse<DNAMapMatterCategorizeOption[]>>;
|
|
40
|
+
/**
|
|
41
|
+
* 获取地图列表
|
|
42
|
+
*/
|
|
43
|
+
getMapCategorizeList(): Promise<DNAApiResponse<DNAMapCategorizeListRes>>;
|
|
44
|
+
/**
|
|
45
|
+
* 获取地图详情
|
|
46
|
+
* @param id 地图ID (getMapCategorizeList().list[].maps[].id)
|
|
47
|
+
*/
|
|
48
|
+
getMapDetail(id: number): Promise<DNAApiResponse<DNAMapDetailRes>>;
|
|
49
|
+
/**
|
|
50
|
+
* 获取地图标点详情
|
|
51
|
+
* @param id 标点ID (getMapDetail().matterCategorizes[].matters[].sites[].id)
|
|
52
|
+
*/
|
|
53
|
+
getMapSiteDetail(id: number): Promise<DNAApiResponse<DNAMapSiteDetailRes>>;
|
|
32
54
|
/**
|
|
33
55
|
* 登录
|
|
34
56
|
*/
|
|
@@ -45,6 +67,10 @@ export declare class DNAAPI {
|
|
|
45
67
|
* 图片上传
|
|
46
68
|
*/
|
|
47
69
|
uploadImage(file: File): Promise<DNAApiResponse<string[]>>;
|
|
70
|
+
/**
|
|
71
|
+
* 获取Emoji列表
|
|
72
|
+
*/
|
|
73
|
+
getEmojiList(): Promise<DNAApiResponse<DNAEmoji[]>>;
|
|
48
74
|
/**
|
|
49
75
|
* 获取登录日志
|
|
50
76
|
*/
|
|
@@ -263,21 +289,13 @@ export declare class DNAAPI {
|
|
|
263
289
|
refer?: boolean;
|
|
264
290
|
token?: string;
|
|
265
291
|
tokenSig?: boolean;
|
|
292
|
+
h5?: boolean;
|
|
266
293
|
}): Promise<{
|
|
267
294
|
headers: Record<string, any>;
|
|
268
295
|
payload: string | FormData | undefined;
|
|
269
296
|
}>;
|
|
270
297
|
private _dna_request;
|
|
271
298
|
}
|
|
272
|
-
declare enum DNAInstanceMHType {
|
|
273
|
-
"角色" = "role",
|
|
274
|
-
"武器" = "weapon",
|
|
275
|
-
"魔之楔" = "mzx",
|
|
276
|
-
"role" = "\u89D2\u8272",
|
|
277
|
-
"weapon" = "\u6B66\u5668",
|
|
278
|
-
"mzx" = "\u9B54\u4E4B\u6954"
|
|
279
|
-
}
|
|
280
|
-
export declare function getDNAInstanceMHType(key: keyof typeof DNAInstanceMHType): DNAInstanceMHType;
|
|
281
299
|
export interface DNAMineRes {
|
|
282
300
|
mine: DNAMine;
|
|
283
301
|
postList: DNAPost[];
|
|
@@ -398,6 +416,125 @@ export interface UserGame {
|
|
|
398
416
|
gameId: number;
|
|
399
417
|
gameName: string;
|
|
400
418
|
}
|
|
419
|
+
export interface DNAEmoji {
|
|
420
|
+
content: string[];
|
|
421
|
+
gameId: number;
|
|
422
|
+
icon: string;
|
|
423
|
+
size: number;
|
|
424
|
+
title: string;
|
|
425
|
+
url: string;
|
|
426
|
+
}
|
|
427
|
+
export interface DNACommonConfigRes {
|
|
428
|
+
logBehaviorConfigVo: DNALogBehaviorConfigVo;
|
|
429
|
+
signApiConfigVo: DNASignApiConfigVo;
|
|
430
|
+
vodOssConfig: DNAVodOssConfig;
|
|
431
|
+
}
|
|
432
|
+
export interface DNAVodOssConfig {
|
|
433
|
+
endPoint: string;
|
|
434
|
+
uploadSizeLimit: string;
|
|
435
|
+
}
|
|
436
|
+
export interface DNASignApiConfigVo {
|
|
437
|
+
/**
|
|
438
|
+
* 签名API列表
|
|
439
|
+
* e.g. [
|
|
440
|
+
"/user/sdkLogin",
|
|
441
|
+
"/forum/postPublish",
|
|
442
|
+
"/forum/comment/createComment",
|
|
443
|
+
"/forum/comment/createReply",
|
|
444
|
+
"/user/getSmsCode",
|
|
445
|
+
"/role/defaultRoleForTool",
|
|
446
|
+
"/media/av/cfg/getVideos",
|
|
447
|
+
"/media/av/cfg/getAudios",
|
|
448
|
+
"/media/av/cfg/getImages"
|
|
449
|
+
]
|
|
450
|
+
*/
|
|
451
|
+
signApiList: string[];
|
|
452
|
+
}
|
|
453
|
+
export interface DNAMapMatterCategorizeOption {
|
|
454
|
+
icon: string;
|
|
455
|
+
id: number;
|
|
456
|
+
matters: DNAMapMatter[];
|
|
457
|
+
name: string;
|
|
458
|
+
sort?: number;
|
|
459
|
+
}
|
|
460
|
+
export interface DNAMatterCategorizeDetail {
|
|
461
|
+
icon: string;
|
|
462
|
+
id: number;
|
|
463
|
+
matters: DNAMapMatterDetail[];
|
|
464
|
+
name: string;
|
|
465
|
+
sort?: number;
|
|
466
|
+
}
|
|
467
|
+
export interface DNAMapMatter {
|
|
468
|
+
icon: string;
|
|
469
|
+
id: number;
|
|
470
|
+
mapMatterCategorizeId: number;
|
|
471
|
+
name: string;
|
|
472
|
+
sort: number;
|
|
473
|
+
}
|
|
474
|
+
export interface DNAMapCategorizeListRes {
|
|
475
|
+
list: DNAMatterCategorizeList[];
|
|
476
|
+
}
|
|
477
|
+
export interface DNAMatterCategorizeList {
|
|
478
|
+
id: number;
|
|
479
|
+
maps: DNAMap[];
|
|
480
|
+
name: string;
|
|
481
|
+
}
|
|
482
|
+
export interface DNALogBehaviorConfigVo {
|
|
483
|
+
freq: number;
|
|
484
|
+
onAndOff: number;
|
|
485
|
+
}
|
|
486
|
+
export interface DNAMapDetailRes {
|
|
487
|
+
floors: DNAMapFloor[];
|
|
488
|
+
matterCategorizes: DNAMatterCategorizeDetail[];
|
|
489
|
+
map: DNAMap;
|
|
490
|
+
userSites: DNAMapSite[];
|
|
491
|
+
}
|
|
492
|
+
export interface DNAMap {
|
|
493
|
+
id: number;
|
|
494
|
+
name: string;
|
|
495
|
+
pid?: number;
|
|
496
|
+
}
|
|
497
|
+
export interface DNAMapMatterDetail extends DNAMapMatter {
|
|
498
|
+
sites: DNAMapSite[];
|
|
499
|
+
}
|
|
500
|
+
export interface DNAMapSite {
|
|
501
|
+
id: number;
|
|
502
|
+
isHide: number;
|
|
503
|
+
mapFloorId: number;
|
|
504
|
+
mapId: number;
|
|
505
|
+
mapMatterId: number;
|
|
506
|
+
x: number;
|
|
507
|
+
y: number;
|
|
508
|
+
}
|
|
509
|
+
export interface DNAMapFloor {
|
|
510
|
+
floor: number;
|
|
511
|
+
id: number;
|
|
512
|
+
name: string;
|
|
513
|
+
pic: string;
|
|
514
|
+
}
|
|
515
|
+
export interface DNAMapSiteDetailRes {
|
|
516
|
+
contributes: Contribute[];
|
|
517
|
+
description: string;
|
|
518
|
+
id: number;
|
|
519
|
+
isDel: number;
|
|
520
|
+
isHide: number;
|
|
521
|
+
mapFloorId: number;
|
|
522
|
+
mapId: number;
|
|
523
|
+
mapMatterCategorizeId: number;
|
|
524
|
+
mapMatterId: number;
|
|
525
|
+
pic: string;
|
|
526
|
+
script: string;
|
|
527
|
+
url: string;
|
|
528
|
+
urlDesc: string;
|
|
529
|
+
urlIcon: string;
|
|
530
|
+
x: number;
|
|
531
|
+
y: number;
|
|
532
|
+
}
|
|
533
|
+
interface Contribute {
|
|
534
|
+
userHeadUrl: string;
|
|
535
|
+
userId: string;
|
|
536
|
+
userName: string;
|
|
537
|
+
}
|
|
401
538
|
export interface DNALoginRes {
|
|
402
539
|
applyCancel?: number;
|
|
403
540
|
gender?: number;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import*as K from"node-forge";var $=268;class k{dev_code;token;fetchFn;is_h5=!1;RSA_PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGpdbezK+eknQZQzPOjp8mr/dP+QHwk8CRkQh6C6qFnfLH3tiyl0pnt3dePuFDnM1PUXGhCkQ157ePJCQgkDU2+mimDmXh0oLFn9zuWSp+U8uLSLX3t3PpJ8TmNCROfUDWvzdbnShqg7JfDmnrOJz49qd234W84nrfTHbzdqeigQIDAQAB";BASE_URL="https://dnabbs-api.yingxiong.com/";uploadKey="";constructor(L,Q="",V={}){this.dev_code=L;this.token=Q;if(this.fetchFn=V.fetchFn,V.is_h5!==void 0)this.is_h5=V.is_h5;if(V.rsa_public_key!==void 0)this.RSA_PUBLIC_KEY=V.rsa_public_key}async getRsaPublicKey(){if(this.RSA_PUBLIC_KEY)return this.RSA_PUBLIC_KEY;let L=await this._dna_request("config/getRsaPublicKey");if(L.is_success&&L.data){let Q=L.data.key;if(typeof Q==="string")this.RSA_PUBLIC_KEY=Q}return this.RSA_PUBLIC_KEY}async login(L,Q){let V={code:Q,devCode:this.dev_code,gameList:$,loginType:1,mobile:L},W=await this._dna_request("user/sdkLogin",V,{sign:!0});if(W.is_success&&W.data){let X=W.data;if(typeof X.token==="string")this.token=X.token}return W}async getSmsCode(L,Q){let V={mobile:L,isCaptcha:1,vJson:Q};return await this._dna_request("user/getSmsCode",V)}async uploadHead(L){let Q=new FormData;Q.append("parts",L);let V=await this._dna_request("user/img/uploadHead",Q,{sign:!0});if(V.is_success&&V.data)V.data=V.data.map((W)=>b(W,this.uploadKey));return V}async uploadImage(L){let Q=new FormData;Q.append("files",L),Q.append("type","post");let V=await this._dna_request("config/img/upload",Q,{sign:!0});if(V.is_success&&V.data)V.data=V.data.map((W)=>b(W,this.uploadKey));return V}async loginLog(){return await this._dna_request("user/login/log")}async getRoleList(){return await this._dna_request("role/list")}async getDefaultRoleForTool(){let L={type:1};return await this._dna_request("role/defaultRoleForTool",L,{sign:!0,token:!0,tokenSig:!0})}async getCharDetail(L,Q,V){let W={charId:L,charEid:Q,type:1,otherUserId:V};return await this._dna_request("role/getCharDetail",W)}async getWeaponDetail(L,Q,V){let W={weaponId:L,weaponEid:Q,type:1,otherUserId:V};return await this._dna_request("role/getWeaponDetail",W)}async getShortNoteInfo(){return await this._dna_request("role/getShortNoteInfo")}async haveSignIn(){let L={gameId:$};return await this._dna_request("user/haveSignInNew",L)}async signCalendar(){let L={gameId:$};return await this._dna_request("encourage/signin/show",L)}async soulTask(){return await this._dna_request("role/soul/task")}async gameSign(L,Q){let V={dayAwardId:L,periodId:Q,signinType:1};return await this._dna_request("encourage/signin/signin",V)}async bbsSign(){let L={gameId:$};return await this._dna_request("user/signIn",L)}async getTaskProcess(){let L={gameId:$};return await this._dna_request("encourage/level/getTaskProcess",L)}async getPostList(L=48,Q=1,V=20,W=1,X=0){let Y={forumId:L,gameId:$,pageIndex:Q,pageSize:V,searchType:W,timeType:X};return await this._dna_request("forum/list",Y)}async lockPost(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postLock",Q)}async postDownOrUp(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postDownOrUp",Q)}async postElite(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postElite",Q)}async postHide(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postHide",Q)}async reRank(L,Q){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,weight:Q};return await this._dna_request("forum/moderator/reRank",V)}async strongRecommend(L,Q=1){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:Q};return await this._dna_request("forum/moderator/setForceRecommend",V)}async adminDelete(L,Q,V){let W={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,content:Q,reasonCode:V};return await this._dna_request("forum/moderator/postDelete",W)}async adminMovePost(L,Q,V,W){let X={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,newGameId:Q,newForumId:V,newTopicIdStr:W};return await this._dna_request("forum/moderator/postMove",X)}async adminRefreshTime(L,Q){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,refresh:Q};return await this._dna_request("forum/moderator/setRefresh",V)}async blockList(){return await this._dna_request("user/block/list")}async blockOther(L,Q,V){let W={blockPostId:L,blockUserId:Q,type:V};return await this._dna_request("user/block/list",W)}async viewCommunity(){return await this._dna_request("encourage/level/viewCommunity")}async viewCount(){return await this._dna_request("forum/viewCount")}async receiveLog(L,Q,V){let W={periodId:L,pageIndex:Q,pageSize:V};return await this._dna_request("encourage/signin/receiveLog",W)}async collect(L,Q,V=1){let W={operateType:V,postId:L,toUserId:Q};return await this._dna_request("forum/collect",W)}async commentDelete(L,Q,V,W){let X={id:L.id,gameId:L.gameId,gameForumId:L.gameForumId,entityType:Q,content:V,reasonCode:W};return await this._dna_request("forum/collect",X)}async recommendList(L,Q,V,W,X=$){let Y={gameId:X,recIndex:L,newIndex:Q,size:V,history:W};return await this._dna_request("forum/recommend/list",Y)}async report({commentId:L=0,postId:Q=0,replyId:V=0},W=1,X=1){let Y={commentId:L,postId:Q,replyId:V,reportReason:W,reportType:X};return await this._dna_request("forum/recommend/list",Y)}async searchPost(L,Q,V,W=$,X=1){let Y={gameId:W,keyword:L,pageIndex:Q,pageSize:V,searchType:X};return await this._dna_request("forum/searchPost",Y)}async searchTopic(L,Q,V=20,W=$){let X={gameId:W,keyword:L,pageIndex:Q,pageSize:V};return await this._dna_request("config/searchTopic",X)}async searchUser(L,Q,V){let W={keyword:L,pageIndex:Q,pageSize:V};return await this._dna_request("user/searchUser",W)}async getPostsByTopic(L=177,Q=1,V=20,W=1,X=0){let Y={topicId:L,gameId:$,pageIndex:Q,pageSize:V,searchType:W,timeType:X};return await this._dna_request("forum/getPostByTopic",Y)}async getPostDetail(L){let Q={postId:L};return await this._dna_request("forum/getPostDetail",Q)}async doFollow(L,Q){let V={followUserId:L,operateType:Q?0:1};return await this._dna_request("user/followUser",V,{sign:!0})}async getFollowState(L){let Q={followUserId:L};return await this._dna_request("user/isFollow",Q)}async doLike(L){let Q={forumId:L.gameForumId,gameId:$,likeType:"1",operateType:"1",postCommentId:"",postCommentReplyId:"",postId:L.postId,postType:L.postType,toUserId:L.userId};return await this._dna_request("forum/like",Q)}async doShare(){let L={gameId:$};return await this._dna_request("encourage/level/shareTask",L)}async createComment(L,Q){let V=JSON.stringify([{content:Q,contentType:"1"}]),W={postId:L.postId,forumId:L.gameForumId,postType:"1",content:V};return await this._dna_request("forum/comment/createComment",W,{sign:!0,params:{toUserId:L.userId}})}async createReply(L,Q){let W={content:JSON.stringify([{content:Q,contentType:"1",imgHeight:0,imgWidth:0,url:""}]),forumId:L.gameForumId,postCommentId:L.postCommentId,postId:L.postId,postType:"1",toUserId:L.userId};return await this._dna_request("forum/comment/createReply",W,{sign:!0,refer:!0,params:{toUserId:L.userId}})}async createReplyList(L,Q){let W={content:JSON.stringify([{content:Q,contentType:"1",imgHeight:0,imgWidth:0,url:""}]),forumId:L.gameForumId,postCommentId:L.postCommentId,postCommentReplyId:L.postCommentReplyId,postId:L.postId,postType:"1",toUserId:L.userId};return await this._dna_request("forum/comment/createReply",W,{sign:!0,refer:!0,params:{toUserId:L.userId}})}async deletePost(L,Q){return await this._dna_request("forum/more/delete",{deleteType:L,id:Q},{sign:!0,refer:!0})}async getOtherMine(L="709542994134436647"){let Q={otherUserId:L,searchType:1,type:2};return await this._dna_request("user/mine",Q)}async getMine(){return await this._dna_request("user/mine")}async getGameConfig(){let L={gameId:$};return await this._dna_request("config/getGameConfig",L)}async getHeaders(L){let{payload:Q,exparams:V,dev_code:W=this.dev_code,refer:X,token:Y=this.token,tokenSig:Z}=L||{},j="application/x-www-form-urlencoded; charset=utf-8",z={version:"1.1.3",source:"ios","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","User-Agent":"DoubleHelix/4 CFNetwork/3860.100.1 Darwin/25.0.0"},v={version:"3.11.0",source:"h5","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"},q={...this.is_h5?v:z};if(W)q.devCode=W;if(X)q.origin="https://dnabbs.yingxiong.com",q.refer="https://dnabbs.yingxiong.com/";if(Y)q.token=Y;if(Q instanceof FormData){let H=await this.getRsaPublicKey(),{signature:O,key:J}=l(H);if(q.t=O,this.uploadKey=J,V)for(let[B,F]of Object.entries(V))Q.append(B,String(F));delete q["Content-Type"]}else if(typeof Q==="object"){let H=I(Q,Z?Y:"");if(Object.assign(Q,{sign:H.s,timestamp:H.t}),V)Object.assign(Q,V);let O=new URLSearchParams;Object.entries(Q).forEach(([f,R])=>{O.append(f,String(R))}),Q=O.toString();let J=H.k,B=await this.getRsaPublicKey(),F=N(J,B);if(this.is_h5)q.k=F;else q.rk=J,q.key=F}return{headers:q,payload:Q}}async _dna_request(L,Q,V){let{method:W="POST",sign:X,refer:Y,params:Z,max_retries:j=3,retry_delay:z=1,timeout:v=1e4,token:q,tokenSig:H}=V||{},O;if(X){let{payload:J,headers:B}=await this.getHeaders({payload:Q,refer:Y,exparams:Z,token:q?this.token:void 0,tokenSig:H});Q=J,O=B}else{let{headers:J}=await this.getHeaders({token:q?this.token:void 0});O=J}for(let J=0;J<j;J++)try{let B=Q;if(Q&&typeof Q==="object"&&!(Q instanceof FormData)){let U=new URLSearchParams;Object.entries(Q).forEach(([u,G])=>{if(G!==void 0)U.append(u,String(G))}),B=U.toString()}let F={method:W,headers:O,body:B},f=new AbortController,R=setTimeout(()=>f.abort(),v),E={...F,signal:f.signal},C=this.fetchFn?await this.fetchFn(`${this.BASE_URL}${L}`,E):await fetch(`${this.BASE_URL}${L}`,E);clearTimeout(R);let w=C.headers.get("content-type")||"",P;if(w.includes("text/")){let U=await C.text();P={code:-999,data:U}}else P=await C.json();if(typeof P==="object"&&P!==null)try{if(typeof P.data==="string")P.data=JSON.parse(P.data)}catch(U){}return new S(P)}catch(B){if(console.error(`请求失败: ${B.message}`),J<j-1)await new Promise((F)=>setTimeout(F,z*Math.pow(2,J)))}return S.err("请求服务器失败,已达最大重试次数")}}var M;((Z)=>{Z.角色="role";Z.武器="weapon";Z.魔之楔="mzx";Z.role="角色";Z.weapon="武器";Z.mzx="魔之楔"})(M||={});function c(L){return M[L]}var g;((W)=>{W[W.TEXT=1]="TEXT";W[W.IMAGE=2]="IMAGE";W[W.VIDEO=5]="VIDEO"})(g||={});class S{code=0;msg="";success=!1;data;constructor(L){this.code=L.code||0,this.msg=L.msg||"",this.success=L.success||!1,this.data=L.data}get is_success(){return this.success&&[0,200].includes(this.code)}static err(L,Q=-999){return new S({code:Q,msg:L,data:void 0,success:!1})}}function N(L,Q){try{let V=[];for(let j=0;j<Q.length;j+=64)V.push(Q.slice(j,j+64));let W=`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
import*as J from"node-forge";var $=268;class k{dev_code;token;fetchFn;is_h5=!1;RSA_PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGpdbezK+eknQZQzPOjp8mr/dP+QHwk8CRkQh6C6qFnfLH3tiyl0pnt3dePuFDnM1PUXGhCkQ157ePJCQgkDU2+mimDmXh0oLFn9zuWSp+U8uLSLX3t3PpJ8TmNCROfUDWvzdbnShqg7JfDmnrOJz49qd234W84nrfTHbzdqeigQIDAQAB";BASE_URL="https://dnabbs-api.yingxiong.com/";uploadKey="";constructor(L,Q="",V={}){this.dev_code=L;this.token=Q;if(this.fetchFn=V.fetchFn,V.is_h5!==void 0)this.is_h5=V.is_h5;if(V.rsa_public_key!==void 0)this.RSA_PUBLIC_KEY=V.rsa_public_key}async getRsaPublicKey(){if(this.RSA_PUBLIC_KEY)return this.RSA_PUBLIC_KEY;let L=await this._dna_request("config/getRsaPublicKey");if(L.is_success&&L.data){let Q=L.data.key;if(typeof Q==="string")this.RSA_PUBLIC_KEY=Q}return this.RSA_PUBLIC_KEY}async getCommonConfig(){return await this._dna_request("config/getCommonConfig")}async getMapMatterCategorizeOptions(){return await this._dna_request("map/matter/categorize/getOptions",void 0,{refer:!0,h5:!0})}async getMapCategorizeList(){return await this._dna_request("map/categorize/list",void 0,{refer:!0,h5:!0})}async getMapDetail(L){return await this._dna_request("map/detail",{id:L},{refer:!0,h5:!0})}async getMapSiteDetail(L){return await this._dna_request("map/site/detail",{id:L},{refer:!0,h5:!0})}async login(L,Q){let V={code:Q,devCode:this.dev_code,gameList:$,loginType:1,mobile:L},W=await this._dna_request("user/sdkLogin",V,{sign:!0});if(W.is_success&&W.data){let X=W.data;if(typeof X.token==="string")this.token=X.token}return W}async getSmsCode(L,Q){let V={mobile:L,isCaptcha:1,vJson:Q};return await this._dna_request("user/getSmsCode",V)}async uploadHead(L){let Q=new FormData;Q.append("parts",L);let V=await this._dna_request("user/img/uploadHead",Q,{sign:!0});if(V.is_success&&V.data)V.data=V.data.map((W)=>b(W,this.uploadKey));return V}async uploadImage(L){let Q=new FormData;Q.append("files",L),Q.append("type","post");let V=await this._dna_request("config/img/upload",Q,{sign:!0});if(V.is_success&&V.data)V.data=V.data.map((W)=>b(W,this.uploadKey));return V}async getEmojiList(){return await this._dna_request("config/getEmoji")}async loginLog(){return await this._dna_request("user/login/log")}async getRoleList(){return await this._dna_request("role/list")}async getDefaultRoleForTool(){let L={type:1};return await this._dna_request("role/defaultRoleForTool",L,{sign:!0,token:!0,tokenSig:!0})}async getCharDetail(L,Q,V){let W={charId:L,charEid:Q,type:1,otherUserId:V};return await this._dna_request("role/getCharDetail",W)}async getWeaponDetail(L,Q,V){let W={weaponId:L,weaponEid:Q,type:1,otherUserId:V};return await this._dna_request("role/getWeaponDetail",W)}async getShortNoteInfo(){return await this._dna_request("role/getShortNoteInfo")}async haveSignIn(){let L={gameId:$};return await this._dna_request("user/haveSignInNew",L)}async signCalendar(){let L={gameId:$};return await this._dna_request("encourage/signin/show",L)}async soulTask(){return await this._dna_request("role/soul/task")}async gameSign(L,Q){let V={dayAwardId:L,periodId:Q,signinType:1};return await this._dna_request("encourage/signin/signin",V)}async bbsSign(){let L={gameId:$};return await this._dna_request("user/signIn",L)}async getTaskProcess(){let L={gameId:$};return await this._dna_request("encourage/level/getTaskProcess",L)}async getPostList(L=48,Q=1,V=20,W=1,X=0){let Y={forumId:L,gameId:$,pageIndex:Q,pageSize:V,searchType:W,timeType:X};return await this._dna_request("forum/list",Y)}async lockPost(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postLock",Q)}async postDownOrUp(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postDownOrUp",Q)}async postElite(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postElite",Q)}async postHide(L){let Q={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:L.operateType};return await this._dna_request("forum/moderator/postHide",Q)}async reRank(L,Q){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,weight:Q};return await this._dna_request("forum/moderator/reRank",V)}async strongRecommend(L,Q=1){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,operateType:Q};return await this._dna_request("forum/moderator/setForceRecommend",V)}async adminDelete(L,Q,V){let W={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,content:Q,reasonCode:V};return await this._dna_request("forum/moderator/postDelete",W)}async adminMovePost(L,Q,V,W){let X={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,newGameId:Q,newForumId:V,newTopicIdStr:W};return await this._dna_request("forum/moderator/postMove",X)}async adminRefreshTime(L,Q){let V={postId:L.postId,gameId:L.gameId??$,gameForumId:L.gameForumId,refresh:Q};return await this._dna_request("forum/moderator/setRefresh",V)}async blockList(){return await this._dna_request("user/block/list")}async blockOther(L,Q,V){let W={blockPostId:L,blockUserId:Q,type:V};return await this._dna_request("user/block/list",W)}async viewCommunity(){return await this._dna_request("encourage/level/viewCommunity")}async viewCount(){return await this._dna_request("forum/viewCount")}async receiveLog(L,Q,V){let W={periodId:L,pageIndex:Q,pageSize:V};return await this._dna_request("encourage/signin/receiveLog",W)}async collect(L,Q,V=1){let W={operateType:V,postId:L,toUserId:Q};return await this._dna_request("forum/collect",W)}async commentDelete(L,Q,V,W){let X={id:L.id,gameId:L.gameId,gameForumId:L.gameForumId,entityType:Q,content:V,reasonCode:W};return await this._dna_request("forum/collect",X)}async recommendList(L,Q,V,W,X=$){let Y={gameId:X,recIndex:L,newIndex:Q,size:V,history:W};return await this._dna_request("forum/recommend/list",Y)}async report({commentId:L=0,postId:Q=0,replyId:V=0},W=1,X=1){let Y={commentId:L,postId:Q,replyId:V,reportReason:W,reportType:X};return await this._dna_request("forum/recommend/list",Y)}async searchPost(L,Q,V,W=$,X=1){let Y={gameId:W,keyword:L,pageIndex:Q,pageSize:V,searchType:X};return await this._dna_request("forum/searchPost",Y)}async searchTopic(L,Q,V=20,W=$){let X={gameId:W,keyword:L,pageIndex:Q,pageSize:V};return await this._dna_request("config/searchTopic",X)}async searchUser(L,Q,V){let W={keyword:L,pageIndex:Q,pageSize:V};return await this._dna_request("user/searchUser",W)}async getPostsByTopic(L=177,Q=1,V=20,W=1,X=0){let Y={topicId:L,gameId:$,pageIndex:Q,pageSize:V,searchType:W,timeType:X};return await this._dna_request("forum/getPostByTopic",Y)}async getPostDetail(L){let Q={postId:L};return await this._dna_request("forum/getPostDetail",Q)}async doFollow(L,Q){let V={followUserId:L,operateType:Q?0:1};return await this._dna_request("user/followUser",V,{sign:!0})}async getFollowState(L){let Q={followUserId:L};return await this._dna_request("user/isFollow",Q)}async doLike(L){let Q={forumId:L.gameForumId,gameId:$,likeType:"1",operateType:"1",postCommentId:"",postCommentReplyId:"",postId:L.postId,postType:L.postType,toUserId:L.userId};return await this._dna_request("forum/like",Q)}async doShare(){let L={gameId:$};return await this._dna_request("encourage/level/shareTask",L)}async createComment(L,Q){let V=JSON.stringify([{content:Q,contentType:"1"}]),W={postId:L.postId,forumId:L.gameForumId,postType:"1",content:V};return await this._dna_request("forum/comment/createComment",W,{sign:!0,params:{toUserId:L.userId}})}async createReply(L,Q){let W={content:JSON.stringify([{content:Q,contentType:"1",imgHeight:0,imgWidth:0,url:""}]),forumId:L.gameForumId,postCommentId:L.postCommentId,postId:L.postId,postType:"1",toUserId:L.userId};return await this._dna_request("forum/comment/createReply",W,{sign:!0,refer:!0,params:{toUserId:L.userId}})}async createReplyList(L,Q){let W={content:JSON.stringify([{content:Q,contentType:"1",imgHeight:0,imgWidth:0,url:""}]),forumId:L.gameForumId,postCommentId:L.postCommentId,postCommentReplyId:L.postCommentReplyId,postId:L.postId,postType:"1",toUserId:L.userId};return await this._dna_request("forum/comment/createReply",W,{sign:!0,refer:!0,params:{toUserId:L.userId}})}async deletePost(L,Q){return await this._dna_request("forum/more/delete",{deleteType:L,id:Q},{sign:!0,refer:!0})}async getOtherMine(L="709542994134436647"){let Q={otherUserId:L,searchType:1,type:2};return await this._dna_request("user/mine",Q)}async getMine(){return await this._dna_request("user/mine")}async getGameConfig(){let L={gameId:$};return await this._dna_request("config/getGameConfig",L)}async getHeaders(L){let{payload:Q,exparams:V,dev_code:W=this.dev_code,refer:X,token:Y=this.token,tokenSig:Z,h5:j}=L||{},z="application/x-www-form-urlencoded; charset=utf-8",v={version:"1.1.3",source:"ios","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","User-Agent":"DoubleHelix/4 CFNetwork/3860.100.1 Darwin/25.0.0"},R={version:"3.11.0",source:"h5","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"},q={...this.is_h5||j?R:v};if(W)q.devCode=W;if(X)q.origin="https://dnabbs.yingxiong.com",q.refer="https://dnabbs.yingxiong.com/";if(Y)q.token=Y;if(Q instanceof FormData){let P=await this.getRsaPublicKey(),{signature:B,key:H}=l(P);if(q.t=B,this.uploadKey=H,V)for(let[K,O]of Object.entries(V))Q.append(K,String(O));delete q["Content-Type"]}else if(typeof Q==="object"){let P=I(Q,Z?Y:"");if(Object.assign(Q,{sign:P.s,timestamp:P.t}),V)Object.assign(Q,V);let B=new URLSearchParams;Object.entries(Q).forEach(([f,C])=>{B.append(f,String(C))}),Q=B.toString();let H=P.k,K=await this.getRsaPublicKey(),O=N(H,K);if(this.is_h5)q.k=O;else q.rk=H,q.key=O}return{headers:q,payload:Q}}async _dna_request(L,Q,V){let{method:W="POST",sign:X,h5:Y,refer:Z,params:j,max_retries:z=3,retry_delay:v=1,timeout:R=1e4,token:q,tokenSig:P}=V||{},B;if(X){let{payload:H,headers:K}=await this.getHeaders({payload:Q,refer:Z,exparams:j,token:q?this.token:void 0,tokenSig:P,h5:Y});Q=H,B=K}else{let{headers:H}=await this.getHeaders({token:q?this.token:void 0,refer:Z,h5:Y});B=H}for(let H=0;H<z;H++)try{let K=Q;if(Q&&typeof Q==="object"&&!(Q instanceof FormData)){let U=new URLSearchParams;Object.entries(Q).forEach(([u,G])=>{if(G!==void 0)U.append(u,String(G))}),K=U.toString()}let O={method:W,headers:B,body:K},f=new AbortController,C=setTimeout(()=>f.abort(),R),M={...O,signal:f.signal},E=this.fetchFn?await this.fetchFn(`${this.BASE_URL}${L}`,M):await fetch(`${this.BASE_URL}${L}`,M);clearTimeout(C);let w=E.headers.get("content-type")||"",F;if(w.includes("text/")){let U=await E.text();F={code:-999,data:U}}else F=await E.json();if(typeof F==="object"&&F!==null)try{if(typeof F.data==="string")F.data=JSON.parse(F.data)}catch(U){}return new S(F)}catch(K){if(console.error(`请求失败: ${K.message}`),H<z-1)await new Promise((O)=>setTimeout(O,v*Math.pow(2,H)))}return S.err("请求服务器失败,已达最大重试次数")}}var g;((W)=>{W[W.TEXT=1]="TEXT";W[W.IMAGE=2]="IMAGE";W[W.VIDEO=5]="VIDEO"})(g||={});class S{code=0;msg="";success=!1;data;constructor(L){this.code=L.code||0,this.msg=L.msg||"",this.success=L.success||!1,this.data=L.data}get is_success(){return this.success&&[0,200].includes(this.code)}static err(L,Q=-999){return new S({code:Q,msg:L,data:void 0,success:!1})}}function N(L,Q){try{let V=[];for(let j=0;j<Q.length;j+=64)V.push(Q.slice(j,j+64));let W=`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
${V.join(`
|
|
3
3
|
`)}
|
|
4
|
-
-----END PUBLIC KEY-----`,X=
|
|
4
|
+
-----END PUBLIC KEY-----`,X=J.pki.publicKeyFromPem(W),Y=J.util.encodeUtf8(L),Z=X.encrypt(Y);return J.util.encode64(Z)}catch(V){throw Error(`[DNA] RSA 加密失败: ${V.message}`)}}function T(L=16){let V="";for(let W=0;W<L;W++)V+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".charAt(Math.floor(Math.random()*62));return V}function D(L){let Q=J.md.md5.create();return Q.update(L),Q.digest().toHex().toUpperCase()}function A(L){function Q(V,W){let X=V.split("");for(let Y=1;Y<W.length;Y+=2){let Z=W[Y-1],j=W[Y];if(Z>=0&&Z<X.length&&j>=0&&j<X.length)[X[Z],X[j]]=[X[j],X[Z]]}return X.join("")}return Q(D(L),[1,13,5,17,7,23])}function m(L,Q){let V=[],W=Object.keys(L).sort();for(let Y of W){let Z=L[Y];if(Z!==null&&Z!==void 0&&Z!=="")V.push(`${Y}=${Z}`)}let X=V.join("&");return A(`${X}&${Q}`)}function h(L,Q){let V=new TextEncoder,W=V.encode(L),X=V.encode(Q),Y=[];for(let Z=0;Z<W.length;Z++){let z=(W[Z]&255)+(X[Z%X.length]&255);Y.push(`@${z}`)}return Y.join("")}function x(L){let Q=L.split(""),V=[[3,23],[11,32],[22,42],[25,48]];for(let[W,X]of V)if(W<Q.length&&X<Q.length)[Q[W],Q[X]]=[Q[X],Q[W]];return Q.join("")}function b(L,Q){let V=x(L),W=J.util.decode64(V),X=J.cipher.createDecipher("AES-CBC",Q);return X.start({iv:"A-16-Byte-String"}),X.update(J.util.createBuffer(W)),X.finish(),X.output.getBytes()}function l(L){let Q=T(16),V=N(Q,L);return{signature:x(V),key:Q}}function I(L,Q){let V=Date.now(),W={...L,timestamp:V,token:Q},X=T(16),Y=m(W,X);return{s:h(Y,X),t:V,k:X}}export{g as PostContentType,k as DNAAPI};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=496FD8ABF189780464756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["..\\src\\index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import * as forge from \"node-forge\"\n//#region const\nenum RespCode {\n ERROR = -999,\n OK_ZERO = 0,\n OK_HTTP = 200,\n BAD_REQUEST = 400,\n SERVER_ERROR = 500,\n}\n\nconst DNA_GAME_ID = 268\n//#endregion\n\n/**\n * DNA API类,用于与DNA游戏服务器交互\n */\nexport class DNAAPI {\n public fetchFn?: typeof fetch\n public is_h5 = false\n public RSA_PUBLIC_KEY =\n \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGpdbezK+eknQZQzPOjp8mr/dP+QHwk8CRkQh6C6qFnfLH3tiyl0pnt3dePuFDnM1PUXGhCkQ157ePJCQgkDU2+mimDmXh0oLFn9zuWSp+U8uLSLX3t3PpJ8TmNCROfUDWvzdbnShqg7JfDmnrOJz49qd234W84nrfTHbzdqeigQIDAQAB\"\n public BASE_URL = \"https://dnabbs-api.yingxiong.com/\"\n private uploadKey: string = \"\"\n\n /**\n * 构造函数\n * @param dev_code 设备码\n * @param uid 用户ID\n * @param token 访问令牌\n * @param options 选项\n * @param options.fetchFn 自定义fetch函数\n * @param options.is_h5 是否为H5端\n * @param options.rsa_public_key RSA公钥(base64) 设为空字符串从服务器获取\n */\n constructor(\n public dev_code: string,\n public token = \"\",\n options: { fetchFn?: typeof fetch; is_h5?: boolean; rsa_public_key?: string } = {},\n ) {\n this.fetchFn = options.fetchFn\n if (options.is_h5 !== undefined) this.is_h5 = options.is_h5\n if (options.rsa_public_key !== undefined) this.RSA_PUBLIC_KEY = options.rsa_public_key\n }\n\n /**\n * 获取RSA公钥\n * @returns RSA公钥(base64)\n */\n async getRsaPublicKey() {\n if (this.RSA_PUBLIC_KEY) {\n return this.RSA_PUBLIC_KEY\n }\n const res = await this._dna_request<{ key: string }>(\"config/getRsaPublicKey\")\n\n if (res.is_success && res.data) {\n const key = res.data.key\n if (typeof key === \"string\") {\n this.RSA_PUBLIC_KEY = key\n }\n }\n return this.RSA_PUBLIC_KEY\n }\n\n /**\n * 登录\n */\n async login(mobile: string, code: string) {\n const data = { code: code, devCode: this.dev_code, gameList: DNA_GAME_ID, loginType: 1, mobile: mobile }\n const res = await this._dna_request<DNALoginRes>(\"user/sdkLogin\", data, { sign: true })\n if (res.is_success && res.data) {\n const data = res.data\n if (typeof data.token === \"string\") {\n this.token = data.token\n }\n }\n return res\n }\n\n /**\n * 获取短信验证码\n */\n async getSmsCode(mobile: string, vJson: string) {\n const data = { mobile, isCaptcha: 1, vJson }\n return await this._dna_request(\"user/getSmsCode\", data)\n }\n\n /**\n * 上传头像\n */\n async uploadHead(file: File) {\n const data = new FormData()\n data.append(\"parts\", file)\n const res = await this._dna_request<string[]>(\"user/img/uploadHead\", data, { sign: true })\n if (res.is_success && res.data) {\n res.data = res.data.map((url) => aesDecryptImageUrl(url, this.uploadKey))\n }\n return res\n }\n\n /**\n * 图片上传\n */\n async uploadImage(file: File) {\n const data = new FormData()\n data.append(\"files\", file)\n data.append(\"type\", \"post\")\n const res = await this._dna_request<string[]>(\"config/img/upload\", data, { sign: true })\n if (res.is_success && res.data) {\n res.data = res.data.map((url) => aesDecryptImageUrl(url, this.uploadKey))\n }\n return res\n }\n\n /**\n * 获取登录日志\n */\n async loginLog() {\n return await this._dna_request<DNALoginRes>(\"user/login/log\")\n }\n\n /**\n * 获取角色列表\n */\n async getRoleList() {\n return await this._dna_request<DNARoleListRes>(\"role/list\")\n }\n\n /**\n * 获取默认角色\n */\n async getDefaultRoleForTool() {\n const data = { type: 1 }\n return await this._dna_request<DNARoleForToolRes>(\"role/defaultRoleForTool\", data, { sign: true, token: true, tokenSig: true })\n }\n\n /**\n * 获取角色详情\n */\n async getCharDetail(char_id: string, char_eid: string, otherUserId?: string) {\n const data = { charId: char_id, charEid: char_eid, type: 1, otherUserId } as any\n return await this._dna_request<DNACharDetailRes>(\"role/getCharDetail\", data)\n }\n\n /**\n * 获取武器详情\n */\n async getWeaponDetail(weapon_id: string, weapon_eid: string, otherUserId?: string) {\n const data = { weaponId: weapon_id, weaponEid: weapon_eid, type: 1, otherUserId }\n return await this._dna_request<DNAWeaponDetailRes>(\"role/getWeaponDetail\", data)\n }\n\n /**\n * 获取角色简讯\n */\n async getShortNoteInfo() {\n return await this._dna_request<DNARoleShortNoteRes>(\"role/getShortNoteInfo\")\n }\n\n /**\n * 检查是否签到\n */\n async haveSignIn() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNAHaveSignInRes>(\"user/haveSignInNew\", data)\n }\n\n /**\n * 签到日历\n */\n async signCalendar() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNACalendarSignRes>(\"encourage/signin/show\", data)\n }\n\n /** ? */\n async soulTask() {\n return await this._dna_request(\"role/soul/task\")\n }\n\n /**\n * 游戏签到\n */\n async gameSign(day_award_id: number, period: number) {\n const data = {\n dayAwardId: day_award_id,\n periodId: period,\n signinType: 1,\n }\n return await this._dna_request(\"encourage/signin/signin\", data)\n }\n\n /**\n * 皎皎角签到\n */\n async bbsSign() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request(\"user/signIn\", data)\n }\n\n /**\n * 获取任务进度\n */\n async getTaskProcess() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNATaskProcessRes>(\"encourage/level/getTaskProcess\", data)\n }\n\n /**\n * 获取帖子列表\n * @param forumId 论坛ID\n * @param pageIndex 页码\n * @param pageSize 每页数量\n * @param searchType 搜索类型 1:最新 2:热门\n * @param timeType 时间类型 0:全部 1:今日 2:本周 3:本月\n * @returns 帖子列表\n */\n async getPostList(forumId: number = 48, pageIndex: number = 1, pageSize: number = 20, searchType: number = 1, timeType: number = 0) {\n const data = {\n forumId: forumId,\n gameId: DNA_GAME_ID,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType, // 1:最新 2:热门\n timeType: timeType, // 0:全部 1:今日 2:本周 3:本月\n }\n return await this._dna_request<DNAPostListRes>(\"forum/list\", data)\n }\n\n /** 管理员锁定帖子 */\n async lockPost(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postLock\", data)\n }\n\n /** 管理员移动帖子 */\n async postDownOrUp(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postDownOrUp\", data)\n }\n\n /** 管理员设精 */\n async postElite(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postElite\", data)\n }\n\n /** 管理员隐藏帖子 */\n async postHide(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postHide\", data)\n }\n\n /** 管理员设置权重 */\n async reRank(post: { postId: number; gameId?: number; gameForumId: number }, weight: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n weight: weight,\n }\n return await this._dna_request(\"forum/moderator/reRank\", data)\n }\n\n /** 管理员设置强推 */\n async strongRecommend(post: { postId: number; gameId?: number; gameForumId: number }, operateType = 1) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: operateType,\n }\n return await this._dna_request(\"forum/moderator/setForceRecommend\", data)\n }\n\n /** 管理员删帖 */\n async adminDelete(post: { postId: number; gameId?: number; gameForumId: number }, content: string, reasonCode: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n content: content,\n reasonCode: reasonCode,\n }\n return await this._dna_request(\"forum/moderator/postDelete\", data)\n }\n /** 管理员移动帖子 */\n async adminMovePost(\n post: { postId: number; gameId?: number; gameForumId: number },\n newGameId: number,\n newForumId: number,\n newTopicIdStr: string,\n ) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n newGameId: newGameId,\n newForumId: newForumId,\n newTopicIdStr: newTopicIdStr,\n }\n return await this._dna_request(\"forum/moderator/postMove\", data)\n }\n /** ? */\n async adminRefreshTime(post: { postId: number; gameId?: number; gameForumId: number }, refresh: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n refresh: refresh,\n }\n return await this._dna_request(\"forum/moderator/setRefresh\", data)\n }\n\n /** 黑名单 */\n async blockList() {\n return await this._dna_request(\"user/block/list\")\n }\n\n /** 拉黑 */\n async blockOther(blockPostId: number, blockUserId: string, type: number) {\n const data = {\n blockPostId: blockPostId,\n blockUserId: blockUserId,\n type: type,\n }\n return await this._dna_request(\"user/block/list\", data)\n }\n\n /** ? */\n async viewCommunity() {\n return await this._dna_request(\"encourage/level/viewCommunity\")\n }\n\n /** ? */\n async viewCount() {\n return await this._dna_request(\"forum/viewCount\")\n }\n\n /** ? */\n async receiveLog(periodId: number, pageIndex: number, pageSize: number) {\n const data = {\n periodId: periodId,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request(\"encourage/signin/receiveLog\", data)\n }\n\n /** 收藏 */\n async collect(postId: number, toUserId: string, operateType = 1) {\n const data = {\n operateType: operateType,\n postId: postId,\n toUserId: toUserId,\n }\n return await this._dna_request(\"forum/collect\", data)\n }\n\n /** 删除评论 */\n async commentDelete(\n comment: { id: number; gameId: number; gameForumId: number },\n entityType: number,\n content: string,\n reasonCode: number,\n ) {\n const data = {\n id: comment.id,\n gameId: comment.gameId,\n gameForumId: comment.gameForumId,\n entityType: entityType,\n content: content,\n reasonCode: reasonCode,\n }\n return await this._dna_request(\"forum/collect\", data)\n }\n\n /** 推荐列表 */\n async recommendList(recIndex: number, newIndex: number, size: number, history: number, gameId = DNA_GAME_ID) {\n const data = {\n gameId: gameId,\n recIndex: recIndex,\n newIndex: newIndex,\n size: size,\n history: history,\n }\n return await this._dna_request(\"forum/recommend/list\", data)\n }\n\n /** 举报 */\n async report(\n { commentId = 0, postId = 0, replyId = 0 }: { commentId?: number; postId?: number; replyId?: number },\n reportReason = 1,\n reportType = 1,\n ) {\n const data = {\n commentId: commentId,\n postId: postId,\n replyId: replyId,\n reportReason: reportReason,\n reportType: reportType,\n }\n return await this._dna_request<DNAPostListRes>(\"forum/recommend/list\", data)\n }\n /** 搜索帖子 */\n async searchPost(keyword: number, pageIndex: number, pageSize: number, gameId = DNA_GAME_ID, searchType = 1) {\n const data = {\n gameId: gameId,\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType,\n }\n return await this._dna_request<DNAPostListRes>(\"forum/searchPost\", data)\n }\n /** 搜索帖子 */\n async searchTopic(keyword: number, pageIndex: number, pageSize = 20, gameId = DNA_GAME_ID) {\n const data = {\n gameId: gameId,\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request<DNAPostListRes>(\"config/searchTopic\", data)\n }\n\n /** 搜索帖子 */\n async searchUser(keyword: number, pageIndex: number, pageSize: number) {\n const data = {\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request<DNAPostListRes>(\"user/searchUser\", data)\n }\n\n /**\n * 获取帖子列表\n * @param topicId 主题ID\n * @param pageIndex 页码\n * @param pageSize 每页数量\n * @param searchType 搜索类型 1:最新 2:热门\n * @param timeType 时间类型 0:全部 1:今日 2:本周 3:本月\n * @returns 帖子列表\n */\n async getPostsByTopic(\n topicId: number = 177,\n pageIndex: number = 1,\n pageSize: number = 20,\n searchType: number = 1,\n timeType: number = 0,\n ) {\n const data = {\n topicId: topicId,\n gameId: DNA_GAME_ID,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType, // 1:最新 2:热门\n timeType: timeType, // 0:全部 1:今日 2:本周 3:本月\n }\n return await this._dna_request<DNAPostListRes>(\"forum/getPostByTopic\", data)\n }\n\n /**\n * 获取帖子详情\n * @param post_id 帖子ID\n * @returns 帖子详情\n */\n async getPostDetail(post_id: string) {\n const data = { postId: post_id }\n return await this._dna_request<DNAPostDetailRes>(\"forum/getPostDetail\", data)\n }\n\n /** 关注用户 */\n async doFollow(userId: string, unfollow?: boolean) {\n const data = {\n followUserId: userId,\n operateType: unfollow ? 0 : 1,\n }\n return await this._dna_request(\"user/followUser\", data, { sign: true })\n }\n\n /** 获取关注状态 */\n async getFollowState(userId: string) {\n const data = {\n followUserId: userId,\n }\n return await this._dna_request(\"user/isFollow\", data)\n }\n\n /**\n * 点赞帖子\n */\n async doLike(post: { gameForumId: string; postId: string; postType: string; userId: string }) {\n const data = {\n forumId: post.gameForumId,\n gameId: DNA_GAME_ID,\n likeType: \"1\",\n operateType: \"1\",\n postCommentId: \"\",\n postCommentReplyId: \"\",\n postId: post.postId,\n postType: post.postType,\n toUserId: post.userId,\n }\n return await this._dna_request(\"forum/like\", data)\n }\n\n /** 分享帖子 */\n async doShare() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request(\"encourage/level/shareTask\", data)\n }\n\n /** 回复帖子 */\n async createComment(post: { userId: string; postId: string; gameForumId: number }, content: string) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n // imgHeight: 0,\n // imgWidth: 0,\n // url: \"\",\n },\n ])\n const data = {\n postId: post.postId,\n forumId: post.gameForumId,\n postType: \"1\",\n content: content_json,\n }\n\n return await this._dna_request(\"forum/comment/createComment\", data, {\n sign: true,\n params: { toUserId: post.userId },\n })\n }\n\n /** 回复评论 */\n async createReply(post: { userId: string; postId: string; postCommentId: string; gameForumId: number }, content: string) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n imgHeight: 0,\n imgWidth: 0,\n url: \"\",\n },\n ])\n const data = {\n content: content_json,\n forumId: post.gameForumId,\n postCommentId: post.postCommentId,\n postId: post.postId,\n postType: \"1\",\n toUserId: post.userId,\n }\n\n return await this._dna_request(\"forum/comment/createReply\", data, { sign: true, refer: true, params: { toUserId: post.userId } })\n }\n\n /** 回复评论的评论 */\n async createReplyList(\n post: { userId: string; postId: string; postCommentId: string; postCommentReplyId: string; gameForumId: number },\n content: string,\n ) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n imgHeight: 0,\n imgWidth: 0,\n url: \"\",\n },\n ])\n const data = {\n content: content_json,\n forumId: post.gameForumId,\n postCommentId: post.postCommentId,\n postCommentReplyId: post.postCommentReplyId,\n postId: post.postId,\n postType: \"1\",\n toUserId: post.userId,\n }\n return await this._dna_request(\"forum/comment/createReply\", data, { sign: true, refer: true, params: { toUserId: post.userId } })\n }\n\n /** 删 */\n async deletePost(deleteType: number, id: number) {\n return await this._dna_request(\"forum/more/delete\", { deleteType, id }, { sign: true, refer: true })\n }\n\n /**\n * 获取用户信息\n * @returns 用户信息\n */\n async getOtherMine(userId = \"709542994134436647\") {\n const data = {\n otherUserId: userId,\n searchType: 1,\n type: 2,\n }\n return await this._dna_request<DNAMineRes>(\"user/mine\", data)\n }\n\n /**\n * 获取用户信息\n * @returns 用户信息\n */\n async getMine() {\n return await this._dna_request<DNAMineRes>(\"user/mine\")\n }\n\n async getGameConfig() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNAGameConfigRes[]>(\"config/getGameConfig\", data)\n }\n\n async getHeaders(options?: {\n payload?: Record<string, any> | string | FormData\n exparams?: Record<string, any>\n dev_code?: string\n refer?: boolean\n token?: string\n tokenSig?: boolean\n }) {\n let { payload, exparams, dev_code = this.dev_code, refer, token = this.token, tokenSig } = options || {}\n\n const CONTENT_TYPE = \"application/x-www-form-urlencoded; charset=utf-8\"\n const iosBaseHeader = {\n version: \"1.1.3\",\n source: \"ios\",\n \"Content-Type\": CONTENT_TYPE,\n \"User-Agent\": \"DoubleHelix/4 CFNetwork/3860.100.1 Darwin/25.0.0\",\n }\n const h5BaseHeader = {\n version: \"3.11.0\",\n source: \"h5\",\n \"Content-Type\": CONTENT_TYPE,\n \"User-Agent\":\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36\",\n }\n // 默认获取ios头\n const headers = { ...(this.is_h5 ? h5BaseHeader : iosBaseHeader) } as Record<string, any>\n if (dev_code) {\n headers.devCode = dev_code\n }\n if (refer) {\n headers.origin = \"https://dnabbs.yingxiong.com\"\n headers.refer = \"https://dnabbs.yingxiong.com/\"\n }\n if (token) {\n headers.token = token\n }\n if (payload instanceof FormData) {\n const pk = await this.getRsaPublicKey()\n const { signature, key } = build_upload_signature(pk)\n headers.t = signature\n this.uploadKey = key\n\n if (exparams) {\n for (const [key, value] of Object.entries(exparams)) {\n payload.append(key, String(value))\n }\n }\n\n delete headers[\"Content-Type\"]\n } else if (typeof payload === \"object\") {\n const si = build_signature(payload, tokenSig ? token : \"\")\n Object.assign(payload, { sign: si.s, timestamp: si.t })\n if (exparams) {\n Object.assign(payload, exparams)\n }\n\n const params = new URLSearchParams()\n Object.entries(payload).forEach(([key, value]) => {\n params.append(key, String(value))\n })\n payload = params.toString()\n\n const rk = si.k\n const pk = await this.getRsaPublicKey()\n const ek = rsa_encrypt(rk, pk)\n if (this.is_h5) {\n headers.k = ek\n } else {\n headers.rk = rk\n headers.key = ek\n }\n }\n return { headers, payload }\n }\n\n private async _dna_request<T = any>(\n url: string,\n data?: any,\n options?: {\n method?: \"GET\" | \"POST\"\n sign?: boolean\n file?: File\n tokenSig?: boolean\n token?: boolean\n refer?: boolean\n params?: Record<string, any>\n max_retries?: number\n retry_delay?: number\n timeout?: number\n },\n ): Promise<DNAApiResponse<T>> {\n let { method = \"POST\", sign, refer, params, max_retries = 3, retry_delay = 1, timeout = 10000, token, tokenSig } = options || {}\n let headers: Record<string, any>\n if (sign) {\n const { payload: p, headers: h } = await this.getHeaders({\n payload: data,\n refer,\n exparams: params,\n token: token ? this.token : undefined,\n tokenSig,\n })\n data = p\n headers = h\n } else {\n const { headers: h } = await this.getHeaders({ token: token ? this.token : undefined })\n headers = h\n }\n\n for (let attempt = 0; attempt < max_retries; attempt++) {\n try {\n let body: string | FormData | undefined = data\n if (data && typeof data === \"object\" && !(data instanceof FormData)) {\n const p = new URLSearchParams()\n Object.entries(data).forEach(([key, value]) => {\n if (value !== undefined) p.append(key, String(value))\n })\n body = p.toString()\n }\n const fetchOptions: RequestInit = {\n method,\n headers,\n body,\n }\n\n // 实现超时控制\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), timeout)\n\n const initOptions = {\n ...fetchOptions,\n signal: controller.signal,\n }\n const response = this.fetchFn\n ? await this.fetchFn(`${this.BASE_URL}${url}`, initOptions)\n : await fetch(`${this.BASE_URL}${url}`, initOptions)\n clearTimeout(timeoutId)\n\n // 获取响应头的 content-type\n const contentType = response.headers.get(\"content-type\") || \"\"\n let raw_res: any\n\n // 根据 content-type 处理响应数据\n if (contentType.includes(\"text/\")) {\n const textData = await response.text()\n raw_res = {\n code: RespCode.ERROR,\n data: textData,\n }\n } else {\n raw_res = await response.json()\n }\n\n if (typeof raw_res === \"object\" && raw_res !== null) {\n try {\n if (typeof raw_res.data === \"string\") {\n raw_res.data = JSON.parse(raw_res.data)\n }\n } catch (e) {\n // 忽略解析错误\n }\n }\n\n return new DNAApiResponse<T>(raw_res)\n } catch (e) {\n console.error(`请求失败: ${(e as Error).message}`)\n if (attempt < max_retries - 1) {\n await new Promise((resolve) => setTimeout(resolve, retry_delay * Math.pow(2, attempt)))\n }\n }\n }\n\n return DNAApiResponse.err(\"请求服务器失败,已达最大重试次数\")\n }\n}\n\nenum DNAInstanceMHType {\n \"角色\" = \"role\",\n \"武器\" = \"weapon\",\n \"魔之楔\" = \"mzx\",\n \"role\" = \"角色\",\n \"weapon\" = \"武器\",\n \"mzx\" = \"魔之楔\",\n}\n\nexport function getDNAInstanceMHType(key: keyof typeof DNAInstanceMHType) {\n return DNAInstanceMHType[key]\n}\n\n//#region 接口定义\n\nexport interface DNAMineRes {\n mine: DNAMine\n postList: DNAPost[]\n hasNext: number\n}\n\nexport interface DNAMine {\n /** 文章数量 */\n articleCount: number\n /** 收藏数量 */\n collectCount: number\n /** 评论数量 */\n commentCount: number\n /** 粉丝数量 */\n fansCount: number\n /** 新粉丝数量 */\n fansNewCount: number\n /** 关注数量 */\n followCount: number\n /** 性别 */\n gender: number\n /** 精华数量 */\n goldNum: number\n /** 头像 */\n headUrl: string\n /** 是否关注 */\n isFollow: number\n /** 是否登录用户 */\n isLoginUser: number\n /** 是否被禁言 */\n isMute: number\n /** 等级 */\n levelTotal: number\n /** 点赞数量 */\n likeCount: number\n /** 手机号 */\n mobile: string\n /** 管理员列表 */\n moderatorVos: any[]\n /** 帖子数量 */\n postCount: number\n /** 注册时间 */\n registerTime: string\n /** 状态 */\n status: number\n /** 趋势数量 */\n trendCount: number\n /** 用户ID */\n userId: string\n /** 用户名 */\n userName: string\n}\n\nexport interface DNAGameConfigRes {\n /** 游戏所有板块列表 */\n gameAllForumList: GameForum[]\n /** 游戏ID */\n gameId: number\n /** 游戏板块图片列表 */\n gameForumPictureList: any[]\n /** 游戏板块列表 */\n gameForumList: GameForum[]\n /** 签到按钮图片 */\n signBtn: string\n sort: number\n /** 话题列表 */\n topicList: GameTopic[]\n /** 背景图片 */\n drawBackgroundUrl: string\n /** 是否默认游戏 */\n gameDefault: number\n /** 签到颜色 */\n signColor: string\n /** 游戏名称 */\n gameName: string\n /** CM图片2 意味不明 */\n drawListUrl: string\n /** 英文站点 */\n configTab: ConfigTab[]\n}\n\nexport interface ConfigTab {\n name: string\n url: string\n}\n\nexport interface GameTopic {\n /** 话题背景图片 */\n backgroundUrl: string\n gameId: number\n /** 话题图标 */\n topicIconUrl: string\n topicId: number\n /** 话题名称 */\n topicName: string\n sort: number\n /** 话题描述 */\n topicDesc: string\n}\n\nexport interface GameForum {\n /** 全部=1 普通=3 */\n forumDataType: number\n /** 固定1 */\n forumUiType: number\n /** 小红点 */\n isTrend: number\n /** 夜间模式图标 */\n iconWhiteUrl: string\n /** 固定1 */\n forumType: number\n /** 板块名称 */\n name: string\n forumListShowType: number\n /** 图标 */\n iconUrl: string\n id: number\n sort: number\n /** 官方 */\n isOfficial: number\n}\n\nexport interface UserGame {\n gameId: number // gameId\n gameName: string // gameName\n}\n\nexport interface DNALoginRes {\n applyCancel?: number // applyCancel\n gender?: number // gender\n signature?: string // signature\n headUrl: string // headUrl\n userName: string // userName\n userId: string // userId\n isOfficial: number // isOfficial\n token: string // token\n userGameList: UserGame[] // userGameList\n isRegister: number // isRegister\n status: number // status\n /** 是否完成绑定 0: 未绑定, 1: 已绑定 */\n isComplete: number\n refreshToken: string // refreshToken\n}\n\nexport interface DNARoleShowVo {\n roleId: string // roleId\n headUrl?: string // headUrl\n level?: number // level\n roleName?: string // roleName\n isDefault?: number // isDefault\n roleRegisterTime?: string // roleRegisterTime\n boundType?: number // boundType\n roleBoundId: string // roleBoundId\n}\n\nexport interface DNARole {\n gameName: string // gameName\n showVoList: DNARoleShowVo[] // showVoList\n gameId: number // gameId\n}\n\nexport interface DNARoleListRes {\n roles: DNARole[] // roles\n}\n\n/** 密函 */\nexport interface DNARoleForToolInstance {\n id: number\n /** 中文 */\n name: string\n /** 密函编码 */\n code: string\n /** 固定0 */\n on: number\n}\n\nexport interface DNARoleForToolInstanceInfo {\n /** 密函列表 */\n instances: DNARoleForToolInstance[] // instances\n}\n\nexport interface DraftDoingInfo {\n draftCompleteNum: number // draftCompleteNum\n draftDoingNum: number // draftDoingNum\n /** 结束时间 */\n endTime: string\n /** 产品id */\n productId?: number\n /** 产品名称 */\n productName: string\n /** 开始时间 */\n startTime: string\n}\n\nexport interface DraftInfo {\n /** 正在做的锻造 */\n draftDoingInfo?: DraftDoingInfo[]\n /** 正在做的锻造数量 */\n draftDoingNum: number\n /** 最大锻造数量 */\n draftMaxNum: number\n}\n\nexport interface DNARoleShortNoteRes {\n /** 迷津进度 */\n rougeLikeRewardCount: number\n /** 迷津总数 */\n rougeLikeRewardTotal: number\n /** 备忘手记进度 */\n currentTaskProgress: number\n /** 备忘手记总数 */\n maxDailyTaskProgress: number\n /** 梦魇进度 */\n hardBossRewardCount: number\n /** 梦魇总数 */\n hardBossRewardTotal: number\n /** 锻造信息 */\n draftInfo: DraftInfo\n}\n\nexport interface DNARoleWeapon {\n weaponId: number\n weaponEid: string\n /** 武器类型图标 */\n elementIcon: string\n /** 武器图标 */\n icon: string\n /** 武器等级 */\n level: number\n /** 武器名称 */\n name: string\n /** 精炼等级 */\n skillLevel: number\n /** 是否解锁 */\n unLocked: boolean\n}\n\nexport interface DNARoleChar {\n charId: number\n charEid: string\n /** 元素图标 */\n elementIcon: string\n /** 命座等级 */\n gradeLevel: number\n /** 角色图标 */\n icon: string\n /** 角色等级 */\n level: number\n /** 角色名称 */\n name: string\n /** 是否解锁 */\n unLocked: boolean\n}\n\nexport interface DNARoleForToolRes {\n /** 角色信息 */\n roleInfo: DNARoleInfo\n /** 密函 */\n instanceInfo: DNARoleForToolInstanceInfo[]\n}\n\nexport interface DNARoleShow {\n /** 角色列表 */\n roleChars: DNARoleChar[]\n /** 武器列表 */\n langRangeWeapons: DNARoleWeapon[]\n /** 武器列表 */\n closeWeapons: DNARoleWeapon[]\n /** 角色头像 */\n headUrl: string\n /** 等级 */\n level: number\n /** 成就列表 */\n params: DNARoleAchievement[]\n /** 角色id */\n roleId: string\n /** 角色名称 */\n roleName: string\n /** 迷津 */\n rougeLikeInfo: DNARougeLikeInfo\n}\n\nexport interface DNARoleAchievement {\n paramKey: string // paramKey\n paramValue: string // paramValue\n}\n\nexport interface DNARoleInfo {\n /** 深渊信息 */\n abyssInfo: DNAAbyssInfo\n /** 角色信息 */\n roleShow: DNARoleShow\n}\n\nexport interface DNARougeLikeInfo {\n /** 最大通过等级 */\n maxPassed: number\n /** 最大通过等级名称 */\n maxPassedName: string\n /** 重置时间 */\n resetTime: string\n /** 奖励数量 */\n rewardCount: number\n /** 奖励总数 */\n rewardTotal: number\n /** 天赋信息 */\n talentInfo: DNARougeLikeTalentInfo[]\n}\n\nexport interface DNARougeLikeTalentInfo {\n cur: string\n max: string\n}\n\nexport interface DNAAbyssInfo {\n /** 阵容 */\n bestTimeVo1: DNABestTimeVo1\n /** 结束时间 */\n endTime: string\n /** 操作名称 */\n operaName: string\n /** 进度名称 */\n progressName: string\n /** 星级 */\n stars: string\n /** 开始时间 */\n startTime: string\n}\n\n/** 深渊阵容 */\nexport interface DNABestTimeVo1 {\n /** 角色图标 */\n charIcon: string\n /** 近战武器图标 */\n closeWeaponIcon: string\n /** 远程武器图标 */\n langRangeWeaponIcon: string\n /** 魔灵图标 */\n petIcon: string\n /** 协战角色图标1 */\n phantomCharIcon1: string\n /** 协战武器图标1 */\n phantomWeaponIcon1: string\n /** 协战角色图标2 */\n phantomCharIcon2: string\n /** 协战武器图标2 */\n phantomWeaponIcon2: string\n}\n\n/** 角色属性 */\nexport interface DNACharAttribute {\n /** 技能范围 */\n skillRange: string\n /** 强化值 */\n strongValue: string\n /** 技能威力 */\n skillIntensity: string\n /** 武器精通 */\n weaponTags: string[]\n /** 防御 */\n def: number\n /** 仇恨值 */\n enmityValue: string\n /** 技能效益 */\n skillEfficiency: string\n /** 技能耐久 */\n skillSustain: string\n /** 最大生命值 */\n maxHp: number\n /** 攻击 */\n atk: number\n /** 最大护盾 */\n maxES: number\n /** 最大神志 */\n maxSp: number\n}\n\n/** 角色技能 */\nexport interface DNARoleSkill {\n /** 技能id */\n skillId: number\n /** 技能图标 */\n icon: string\n /** 技能等级 */\n level: number\n /** 技能名称 */\n skillName: string\n}\n\n/** 溯源 */\nexport interface DNARoleTrace {\n /** 溯源图标 */\n icon: string\n /** 溯源描述 */\n description: string\n}\n\n/** 魔之楔 */\nexport interface DNARoleMod {\n /** id 没佩戴为-1 */\n id: number\n /** 图标 */\n icon?: string\n /** 质量 */\n quality?: number\n /** 名称 */\n name?: string\n}\n\nexport interface DNACharDetail {\n charId: number\n /** 角色属性 */\n attribute: DNACharAttribute\n /** 角色技能 */\n skills: DNARoleSkill[]\n /** 立绘 */\n paint: string\n /** 角色名称 */\n charName: string\n /** 元素图标 */\n elementIcon: string\n /** 溯源 */\n traces: DNARoleTrace[]\n /** 当前魔之楔 */\n currentVolume: number\n /** 最大魔之楔 */\n sumVolume: number\n /** 角色等级 */\n level: number\n /** 角色头像 */\n icon: string\n /** 溯源等级 0-6 */\n gradeLevel: number\n /** 元素名称 */\n elementName: string\n /** 魔之楔列表 */\n modes: DNARoleMod[]\n}\n\nexport interface DNACharDetailRes {\n /** 角色详情 */\n charDetail: DNACharDetail\n}\n\nexport interface DNAWeaponDetailRes {\n /** 武器详情 */\n weaponDetail: DNAWeaponDetail\n}\n\nexport interface DNAWeaponDetail {\n attribute: DNAWeaponAttribute\n currentVolume: number\n description: string\n elementIcon: string\n elementName: string\n icon: string\n id: number\n level: number\n modes: DNARoleMod[]\n name: string\n skillLevel: number\n sumVolume: number\n}\n\nexport interface DNAWeaponAttribute {\n atk: number\n crd: number\n cri: number\n speed: number\n trigger: number\n}\n\nexport interface DNADayAward {\n gameId: number // gameId\n periodId: number // periodId\n iconUrl: string // iconUrl\n id: number // id\n dayInPeriod: number // dayInPeriod\n updateTime: number // updateTime\n awardNum: number // awardNum\n thirdProductId: string // thirdProductId\n createTime: number // createTime\n awardName: string // awardName\n}\n\nexport interface DNACaSignPeriod {\n gameId: number // gameId\n retryCos: number // retryCos\n endDate: number // endDate\n id: number // id\n startDate: number // startDate\n retryTimes: number // retryTimes\n overDays: number // overDays\n createTime: number // createTime\n name: string // name\n}\n\nexport interface DNACaSignRoleInfo {\n headUrl: string // headUrl\n roleId: string // roleId\n roleName: string // roleName\n level: number // level\n roleBoundId: string // roleBoundId\n}\n\nexport interface DNAHaveSignInRes {\n /** 已签到天数 */\n totalSignInDay: number\n}\n\nexport interface DNACalendarSignRes {\n todaySignin: boolean // todaySignin\n userGoldNum: number // userGoldNum\n dayAward: DNADayAward[] // dayAward\n signinTime: number // signinTime\n period: DNACaSignPeriod // period\n roleInfo: DNACaSignRoleInfo // roleInfo\n}\n\nexport interface DNABBSTask {\n /** 备注 */\n remark: string\n /** 完成次数 */\n completeTimes: number\n /** 需要次数 */\n times: number\n /** skipType */\n skipType: number\n /** 获取经验 */\n gainExp: number\n /** 进度 */\n process: number\n /** 获取金币 */\n gainGold: number\n /** 任务标识名 */\n markName?: string\n}\n\nexport interface DNATaskProcessRes {\n dailyTask: DNABBSTask[] // dailyTask\n}\n\nexport interface DNATopicPostListRes {\n postList: DNAPost[]\n topic: DNATopicDetail\n hasNext: number\n}\n\nexport interface DNATopicDetail {\n backgroundUrl: string\n gameId: number\n sort: number\n topicDesc: string\n topicIconUrl: string\n topicId: number\n topicName: string\n}\n\nexport interface DNAPost {\n browseCount: string\n collectionCount: number\n commentCount: number\n gameForumId: number\n gameId: number\n gameName: string\n imgContent: DNAPostImgContent[]\n imgCount: number\n isCollect: number\n isCreator: number\n isElite: number\n isFollow: number\n isLike: number\n isLock: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n postContent: string\n postCover: string\n postCoverVo: DNAPostCoverVo\n postId: string\n postStatus: number\n postTitle: string\n postType: number\n showTime: string\n topics: DNATopicShort[]\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNATopicShort {\n topicId: number\n topicName: string\n}\n\nexport interface DNAPostCoverVo {\n imgHeight: number\n imgWidth: number\n}\n\nexport interface DNAPostImgContent {\n imgHeight: number\n imgWidth: number\n url: string\n isAbnormal?: boolean\n}\n\nexport interface DNAPostListRes {\n postList: DNAPost[] // posts\n topList: any[]\n hasNext: number\n}\n\nexport interface DNAPostDetailRes {\n isHotCount: boolean\n gameId: number\n isFollow: number\n isLike: number\n postDetail: DNAPostDetail\n isCollect: number\n hasNext: number\n comment: DNAComment[]\n}\n\nexport interface DNAPostDetail {\n auditStatus: number\n browseCount: string\n checkStatus: number\n collectionCount: number\n commentCount: number\n gameForumId: number\n gameForumVo: DNAGameForumVo\n gameId: number\n gameName: string\n headCodeUrl: string\n id: string\n isCreator: number\n isElite: number\n isForceRecommend: number\n isHide: number\n isLock: number\n isMine: number\n isOfficial: number\n isRecommend: number\n isTop: number\n lastEditorTime?: string\n likeCount: number\n postContent: DNAPostContent[]\n postH5Content: string\n postTime: string\n postTitle: string\n postType: number\n postUserId: string\n refreshHour: number\n score: number\n topics: DNATopicShort[]\n userHeadCode: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n whiteUrl: any[]\n}\n\nexport interface DNAPostContent {\n contentType: PostContentType\n imgHeight: number\n imgWidth: number\n url?: string\n content?: string\n contentVideo?: DNAPostContentVideo\n}\n\nexport interface DNAComment {\n checkStatus: number\n commentContent: DNAPostContent[]\n commentId: string\n commentTime: string\n contentTextStatus: number\n floor: number\n isCreator: number\n isLike: number\n isMine: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n replyCount: number\n replyVos: DNAReplyVos[]\n userHeadCode?: string\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNAReplyVos {\n checkStatus: number\n contentTextStatus: number\n createTime: number\n isCreator: number\n isLike: number\n isMine: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n postCommentId: string\n postCommentReplayId: string\n replyContent: DNAPostContent[]\n replyContentStr: string\n replyId: string\n replyTime: string\n toUserIsCreator: number\n toUserModeratorIdentity: number\n toUserName: string\n userHeadCode?: string\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNAGameForumVo {\n forumDataType: number\n forumListShowType: number\n forumType: number\n forumUiType: number\n iconUrl: string\n iconWhiteUrl: string\n id: number\n isOfficial: number\n isTrend: number\n name: string\n sort: number\n}\n\nexport enum PostContentType {\n TEXT = 1,\n IMAGE = 2,\n VIDEO = 5,\n}\n\nexport interface DNAPostContentVideo {\n videoUrl: string // videoUrl\n coverUrl?: string // coverUrl\n}\n\nclass DNAApiResponse<T = any> {\n code: number = 0\n msg: string = \"\"\n success: boolean = false\n data?: T\n\n constructor(raw_data: any) {\n this.code = raw_data.code || 0\n this.msg = raw_data.msg || \"\"\n this.success = raw_data.success || false\n this.data = raw_data.data\n }\n\n // 判断是否成功\n get is_success() {\n return this.success && [RespCode.OK_ZERO, RespCode.OK_HTTP].includes(this.code)\n }\n\n // 错误响应静态方法\n static err<T = undefined>(msg: string, code: number = RespCode.ERROR): DNAApiResponse<T> {\n return new DNAApiResponse<T>({ code, msg, data: undefined, success: false })\n }\n}\n//#endregion\n\n//#region utils\n\n// RSA加密函数\nfunction rsa_encrypt(text: string, public_key_b64: string): string {\n try {\n // 将base64公钥转换为PEM格式\n const lines: string[] = []\n for (let i = 0; i < public_key_b64.length; i += 64) {\n lines.push(public_key_b64.slice(i, i + 64))\n }\n const pem = `-----BEGIN PUBLIC KEY-----\\n${lines.join(\"\\n\")}\\n-----END PUBLIC KEY-----`\n\n // 导入PEM格式的RSA公钥\n const publicKey = forge.pki.publicKeyFromPem(pem)\n\n // 执行PKCS1_v1_5加密\n const textBytes = forge.util.encodeUtf8(text)\n const encrypted = publicKey.encrypt(textBytes)\n\n return forge.util.encode64(encrypted)\n } catch (e) {\n throw new Error(`[DNA] RSA 加密失败: ${(e as Error).message}`)\n }\n}\n\n// 生成随机字符串\nfunction rand_str(length: number = 16): string {\n const chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length))\n }\n return result\n}\n\n// MD5加密并转换为大写\nfunction md5_upper(text: string): string {\n const md = forge.md.md5.create()\n md.update(text)\n return md.digest().toHex().toUpperCase()\n}\n\n// 签名哈希函数\nfunction signature_hash(text: string): string {\n function swap_positions(text: string, positions: number[]): string {\n const chars = text.split(\"\")\n for (let i = 1; i < positions.length; i += 2) {\n const p1 = positions[i - 1]\n const p2 = positions[i]\n if (p1 >= 0 && p1 < chars.length && p2 >= 0 && p2 < chars.length) {\n ;[chars[p1], chars[p2]] = [chars[p2], chars[p1]]\n }\n }\n return chars.join(\"\")\n }\n return swap_positions(md5_upper(text), [1, 13, 5, 17, 7, 23])\n}\n\n// 签名函数\nfunction sign_fI(data: Record<string, any>, secret: string): string {\n const pairs: string[] = []\n const sortedKeys = Object.keys(data).sort()\n for (const k of sortedKeys) {\n const v = data[k]\n if (v !== null && v !== undefined && v !== \"\") {\n pairs.push(`${k}=${v}`)\n }\n }\n const qs = pairs.join(\"&\")\n return signature_hash(`${qs}&${secret}`)\n}\n\n// XOR编码函数\nfunction xor_encode(text: string, key: string): string {\n const encoder = new TextEncoder()\n const tb = encoder.encode(text)\n const kb = encoder.encode(key)\n const out: string[] = []\n for (let i = 0; i < tb.length; i++) {\n const b = tb[i]\n const e = (b & 255) + (kb[i % kb.length] & 255)\n out.push(`@${e}`)\n }\n return out.join(\"\")\n}\n\n// 上传图片签名 - 字符交换\nfunction swapForUploadImgApp(text: string): string {\n const chars = text.split(\"\")\n const swaps = [\n [3, 23],\n [11, 32],\n [22, 42],\n [25, 48],\n ]\n for (const [p1, p2] of swaps) {\n if (p1 < chars.length && p2 < chars.length) {\n ;[chars[p1], chars[p2]] = [chars[p2], chars[p1]]\n }\n }\n return chars.join(\"\")\n}\n\n// AES 解密图片 URL\nfunction aesDecryptImageUrl(encryptedUrl: string, key: string): string {\n const swapped = swapForUploadImgApp(encryptedUrl)\n\n const encryptedData = forge.util.decode64(swapped)\n\n const decipher = forge.cipher.createDecipher(\"AES-CBC\", key)\n decipher.start({ iv: \"A-16-Byte-String\" })\n decipher.update(forge.util.createBuffer(encryptedData))\n decipher.finish()\n\n return decipher.output.getBytes()\n}\n\n// 构建上传图片签名(返回签名和密钥)\nfunction build_upload_signature(public_key: string): { signature: string; key: string } {\n const key = rand_str(16)\n const encrypted = rsa_encrypt(key, public_key)\n const signature = swapForUploadImgApp(encrypted)\n return { signature, key }\n}\n\n// 构建普通签名\nfunction build_signature(data: Record<string, any>, token?: string): Record<string, any> {\n const ts = Date.now()\n const sign_data = { ...data, timestamp: ts, token }\n const sec = rand_str(16)\n const sig = sign_fI(sign_data, sec)\n const enc = xor_encode(sig, sec)\n return { s: enc, t: ts, k: sec }\n}\n//#endregion\n"
|
|
5
|
+
"import * as forge from \"node-forge\"\n//#region const\nenum RespCode {\n ERROR = -999,\n OK_ZERO = 0,\n OK_HTTP = 200,\n BAD_REQUEST = 400,\n SERVER_ERROR = 500,\n}\n\nconst DNA_GAME_ID = 268\n//#endregion\n\n/**\n * DNA API类,用于与DNA游戏服务器交互\n */\nexport class DNAAPI {\n public fetchFn?: typeof fetch\n public is_h5 = false\n public RSA_PUBLIC_KEY =\n \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGpdbezK+eknQZQzPOjp8mr/dP+QHwk8CRkQh6C6qFnfLH3tiyl0pnt3dePuFDnM1PUXGhCkQ157ePJCQgkDU2+mimDmXh0oLFn9zuWSp+U8uLSLX3t3PpJ8TmNCROfUDWvzdbnShqg7JfDmnrOJz49qd234W84nrfTHbzdqeigQIDAQAB\"\n public BASE_URL = \"https://dnabbs-api.yingxiong.com/\"\n private uploadKey: string = \"\"\n\n /**\n * 构造函数\n * @param dev_code 设备码\n * @param uid 用户ID\n * @param token 访问令牌\n * @param options 选项\n * @param options.fetchFn 自定义fetch函数\n * @param options.is_h5 是否为H5端\n * @param options.rsa_public_key RSA公钥(base64) 设为空字符串从服务器获取\n */\n constructor(\n public dev_code: string,\n public token = \"\",\n options: { fetchFn?: typeof fetch; is_h5?: boolean; rsa_public_key?: string } = {},\n ) {\n this.fetchFn = options.fetchFn\n if (options.is_h5 !== undefined) this.is_h5 = options.is_h5\n if (options.rsa_public_key !== undefined) this.RSA_PUBLIC_KEY = options.rsa_public_key\n }\n\n /**\n * 获取RSA公钥\n * @returns RSA公钥(base64)\n */\n async getRsaPublicKey() {\n if (this.RSA_PUBLIC_KEY) {\n return this.RSA_PUBLIC_KEY\n }\n const res = await this._dna_request<{ key: string }>(\"config/getRsaPublicKey\")\n\n if (res.is_success && res.data) {\n const key = res.data.key\n if (typeof key === \"string\") {\n this.RSA_PUBLIC_KEY = key\n }\n }\n return this.RSA_PUBLIC_KEY\n }\n\n /**\n * 获取通用配置\n */\n async getCommonConfig() {\n return await this._dna_request<DNACommonConfigRes>(\"config/getCommonConfig\")\n }\n\n /**\n * 获取地图标点分类\n */\n async getMapMatterCategorizeOptions() {\n return await this._dna_request<DNAMapMatterCategorizeOption[]>(\"map/matter/categorize/getOptions\", undefined, {\n refer: true,\n h5: true,\n })\n }\n\n /**\n * 获取地图列表\n */\n async getMapCategorizeList() {\n return await this._dna_request<DNAMapCategorizeListRes>(\"map/categorize/list\", undefined, { refer: true, h5: true })\n }\n\n /**\n * 获取地图详情\n * @param id 地图ID (getMapCategorizeList().list[].maps[].id)\n */\n async getMapDetail(id: number) {\n return await this._dna_request<DNAMapDetailRes>(\"map/detail\", { id }, { refer: true, h5: true })\n }\n\n /**\n * 获取地图标点详情\n * @param id 标点ID (getMapDetail().matterCategorizes[].matters[].sites[].id)\n */\n async getMapSiteDetail(id: number) {\n return await this._dna_request<DNAMapSiteDetailRes>(\"map/site/detail\", { id }, { refer: true, h5: true })\n }\n\n /**\n * 登录\n */\n async login(mobile: string, code: string) {\n const data = { code: code, devCode: this.dev_code, gameList: DNA_GAME_ID, loginType: 1, mobile: mobile }\n const res = await this._dna_request<DNALoginRes>(\"user/sdkLogin\", data, { sign: true })\n if (res.is_success && res.data) {\n const data = res.data\n if (typeof data.token === \"string\") {\n this.token = data.token\n }\n }\n return res\n }\n\n /**\n * 获取短信验证码\n */\n async getSmsCode(mobile: string, vJson: string) {\n const data = { mobile, isCaptcha: 1, vJson }\n return await this._dna_request(\"user/getSmsCode\", data)\n }\n\n /**\n * 上传头像\n */\n async uploadHead(file: File) {\n const data = new FormData()\n data.append(\"parts\", file)\n const res = await this._dna_request<string[]>(\"user/img/uploadHead\", data, { sign: true })\n if (res.is_success && res.data) {\n res.data = res.data.map((url) => aesDecryptImageUrl(url, this.uploadKey))\n }\n return res\n }\n\n /**\n * 图片上传\n */\n async uploadImage(file: File) {\n const data = new FormData()\n data.append(\"files\", file)\n data.append(\"type\", \"post\")\n const res = await this._dna_request<string[]>(\"config/img/upload\", data, { sign: true })\n if (res.is_success && res.data) {\n res.data = res.data.map((url) => aesDecryptImageUrl(url, this.uploadKey))\n }\n return res\n }\n\n /**\n * 获取Emoji列表\n */\n async getEmojiList() {\n return await this._dna_request<DNAEmoji[]>(\"config/getEmoji\")\n }\n\n /**\n * 获取登录日志\n */\n async loginLog() {\n return await this._dna_request<DNALoginRes>(\"user/login/log\")\n }\n\n /**\n * 获取角色列表\n */\n async getRoleList() {\n return await this._dna_request<DNARoleListRes>(\"role/list\")\n }\n\n /**\n * 获取默认角色\n */\n async getDefaultRoleForTool() {\n const data = { type: 1 }\n return await this._dna_request<DNARoleForToolRes>(\"role/defaultRoleForTool\", data, { sign: true, token: true, tokenSig: true })\n }\n\n /**\n * 获取角色详情\n */\n async getCharDetail(char_id: string, char_eid: string, otherUserId?: string) {\n const data = { charId: char_id, charEid: char_eid, type: 1, otherUserId } as any\n return await this._dna_request<DNACharDetailRes>(\"role/getCharDetail\", data)\n }\n\n /**\n * 获取武器详情\n */\n async getWeaponDetail(weapon_id: string, weapon_eid: string, otherUserId?: string) {\n const data = { weaponId: weapon_id, weaponEid: weapon_eid, type: 1, otherUserId }\n return await this._dna_request<DNAWeaponDetailRes>(\"role/getWeaponDetail\", data)\n }\n\n /**\n * 获取角色简讯\n */\n async getShortNoteInfo() {\n return await this._dna_request<DNARoleShortNoteRes>(\"role/getShortNoteInfo\")\n }\n\n /**\n * 检查是否签到\n */\n async haveSignIn() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNAHaveSignInRes>(\"user/haveSignInNew\", data)\n }\n\n /**\n * 签到日历\n */\n async signCalendar() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNACalendarSignRes>(\"encourage/signin/show\", data)\n }\n\n /** ? */\n async soulTask() {\n return await this._dna_request(\"role/soul/task\")\n }\n\n /**\n * 游戏签到\n */\n async gameSign(day_award_id: number, period: number) {\n const data = {\n dayAwardId: day_award_id,\n periodId: period,\n signinType: 1,\n }\n return await this._dna_request(\"encourage/signin/signin\", data)\n }\n\n /**\n * 皎皎角签到\n */\n async bbsSign() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request(\"user/signIn\", data)\n }\n\n /**\n * 获取任务进度\n */\n async getTaskProcess() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNATaskProcessRes>(\"encourage/level/getTaskProcess\", data)\n }\n\n /**\n * 获取帖子列表\n * @param forumId 论坛ID\n * @param pageIndex 页码\n * @param pageSize 每页数量\n * @param searchType 搜索类型 1:最新 2:热门\n * @param timeType 时间类型 0:全部 1:今日 2:本周 3:本月\n * @returns 帖子列表\n */\n async getPostList(forumId: number = 48, pageIndex: number = 1, pageSize: number = 20, searchType: number = 1, timeType: number = 0) {\n const data = {\n forumId: forumId,\n gameId: DNA_GAME_ID,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType, // 1:最新 2:热门\n timeType: timeType, // 0:全部 1:今日 2:本周 3:本月\n }\n return await this._dna_request<DNAPostListRes>(\"forum/list\", data)\n }\n\n /** 管理员锁定帖子 */\n async lockPost(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postLock\", data)\n }\n\n /** 管理员移动帖子 */\n async postDownOrUp(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postDownOrUp\", data)\n }\n\n /** 管理员设精 */\n async postElite(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postElite\", data)\n }\n\n /** 管理员隐藏帖子 */\n async postHide(post: { postId: number; gameId?: number; gameForumId: number; operateType: number }) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: post.operateType,\n }\n return await this._dna_request(\"forum/moderator/postHide\", data)\n }\n\n /** 管理员设置权重 */\n async reRank(post: { postId: number; gameId?: number; gameForumId: number }, weight: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n weight: weight,\n }\n return await this._dna_request(\"forum/moderator/reRank\", data)\n }\n\n /** 管理员设置强推 */\n async strongRecommend(post: { postId: number; gameId?: number; gameForumId: number }, operateType = 1) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n operateType: operateType,\n }\n return await this._dna_request(\"forum/moderator/setForceRecommend\", data)\n }\n\n /** 管理员删帖 */\n async adminDelete(post: { postId: number; gameId?: number; gameForumId: number }, content: string, reasonCode: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n content: content,\n reasonCode: reasonCode,\n }\n return await this._dna_request(\"forum/moderator/postDelete\", data)\n }\n /** 管理员移动帖子 */\n async adminMovePost(\n post: { postId: number; gameId?: number; gameForumId: number },\n newGameId: number,\n newForumId: number,\n newTopicIdStr: string,\n ) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n newGameId: newGameId,\n newForumId: newForumId,\n newTopicIdStr: newTopicIdStr,\n }\n return await this._dna_request(\"forum/moderator/postMove\", data)\n }\n /** ? */\n async adminRefreshTime(post: { postId: number; gameId?: number; gameForumId: number }, refresh: number) {\n const data = {\n postId: post.postId,\n gameId: post.gameId ?? DNA_GAME_ID,\n gameForumId: post.gameForumId,\n refresh: refresh,\n }\n return await this._dna_request(\"forum/moderator/setRefresh\", data)\n }\n\n /** 黑名单 */\n async blockList() {\n return await this._dna_request(\"user/block/list\")\n }\n\n /** 拉黑 */\n async blockOther(blockPostId: number, blockUserId: string, type: number) {\n const data = {\n blockPostId: blockPostId,\n blockUserId: blockUserId,\n type: type,\n }\n return await this._dna_request(\"user/block/list\", data)\n }\n\n /** ? */\n async viewCommunity() {\n return await this._dna_request(\"encourage/level/viewCommunity\")\n }\n\n /** ? */\n async viewCount() {\n return await this._dna_request(\"forum/viewCount\")\n }\n\n /** ? */\n async receiveLog(periodId: number, pageIndex: number, pageSize: number) {\n const data = {\n periodId: periodId,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request(\"encourage/signin/receiveLog\", data)\n }\n\n /** 收藏 */\n async collect(postId: number, toUserId: string, operateType = 1) {\n const data = {\n operateType: operateType,\n postId: postId,\n toUserId: toUserId,\n }\n return await this._dna_request(\"forum/collect\", data)\n }\n\n /** 删除评论 */\n async commentDelete(\n comment: { id: number; gameId: number; gameForumId: number },\n entityType: number,\n content: string,\n reasonCode: number,\n ) {\n const data = {\n id: comment.id,\n gameId: comment.gameId,\n gameForumId: comment.gameForumId,\n entityType: entityType,\n content: content,\n reasonCode: reasonCode,\n }\n return await this._dna_request(\"forum/collect\", data)\n }\n\n /** 推荐列表 */\n async recommendList(recIndex: number, newIndex: number, size: number, history: number, gameId = DNA_GAME_ID) {\n const data = {\n gameId: gameId,\n recIndex: recIndex,\n newIndex: newIndex,\n size: size,\n history: history,\n }\n return await this._dna_request(\"forum/recommend/list\", data)\n }\n\n /** 举报 */\n async report(\n { commentId = 0, postId = 0, replyId = 0 }: { commentId?: number; postId?: number; replyId?: number },\n reportReason = 1,\n reportType = 1,\n ) {\n const data = {\n commentId: commentId,\n postId: postId,\n replyId: replyId,\n reportReason: reportReason,\n reportType: reportType,\n }\n return await this._dna_request<DNAPostListRes>(\"forum/recommend/list\", data)\n }\n /** 搜索帖子 */\n async searchPost(keyword: number, pageIndex: number, pageSize: number, gameId = DNA_GAME_ID, searchType = 1) {\n const data = {\n gameId: gameId,\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType,\n }\n return await this._dna_request<DNAPostListRes>(\"forum/searchPost\", data)\n }\n /** 搜索帖子 */\n async searchTopic(keyword: number, pageIndex: number, pageSize = 20, gameId = DNA_GAME_ID) {\n const data = {\n gameId: gameId,\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request<DNAPostListRes>(\"config/searchTopic\", data)\n }\n\n /** 搜索帖子 */\n async searchUser(keyword: number, pageIndex: number, pageSize: number) {\n const data = {\n keyword: keyword,\n pageIndex: pageIndex,\n pageSize: pageSize,\n }\n return await this._dna_request<DNAPostListRes>(\"user/searchUser\", data)\n }\n\n /**\n * 获取帖子列表\n * @param topicId 主题ID\n * @param pageIndex 页码\n * @param pageSize 每页数量\n * @param searchType 搜索类型 1:最新 2:热门\n * @param timeType 时间类型 0:全部 1:今日 2:本周 3:本月\n * @returns 帖子列表\n */\n async getPostsByTopic(\n topicId: number = 177,\n pageIndex: number = 1,\n pageSize: number = 20,\n searchType: number = 1,\n timeType: number = 0,\n ) {\n const data = {\n topicId: topicId,\n gameId: DNA_GAME_ID,\n pageIndex: pageIndex,\n pageSize: pageSize,\n searchType: searchType, // 1:最新 2:热门\n timeType: timeType, // 0:全部 1:今日 2:本周 3:本月\n }\n return await this._dna_request<DNAPostListRes>(\"forum/getPostByTopic\", data)\n }\n\n /**\n * 获取帖子详情\n * @param post_id 帖子ID\n * @returns 帖子详情\n */\n async getPostDetail(post_id: string) {\n const data = { postId: post_id }\n return await this._dna_request<DNAPostDetailRes>(\"forum/getPostDetail\", data)\n }\n\n /** 关注用户 */\n async doFollow(userId: string, unfollow?: boolean) {\n const data = {\n followUserId: userId,\n operateType: unfollow ? 0 : 1,\n }\n return await this._dna_request(\"user/followUser\", data, { sign: true })\n }\n\n /** 获取关注状态 */\n async getFollowState(userId: string) {\n const data = {\n followUserId: userId,\n }\n return await this._dna_request(\"user/isFollow\", data)\n }\n\n /**\n * 点赞帖子\n */\n async doLike(post: { gameForumId: string; postId: string; postType: string; userId: string }) {\n const data = {\n forumId: post.gameForumId,\n gameId: DNA_GAME_ID,\n likeType: \"1\",\n operateType: \"1\",\n postCommentId: \"\",\n postCommentReplyId: \"\",\n postId: post.postId,\n postType: post.postType,\n toUserId: post.userId,\n }\n return await this._dna_request(\"forum/like\", data)\n }\n\n /** 分享帖子 */\n async doShare() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request(\"encourage/level/shareTask\", data)\n }\n\n /** 回复帖子 */\n async createComment(post: { userId: string; postId: string; gameForumId: number }, content: string) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n // imgHeight: 0,\n // imgWidth: 0,\n // url: \"\",\n },\n ])\n const data = {\n postId: post.postId,\n forumId: post.gameForumId,\n postType: \"1\",\n content: content_json,\n }\n\n return await this._dna_request(\"forum/comment/createComment\", data, {\n sign: true,\n params: { toUserId: post.userId },\n })\n }\n\n /** 回复评论 */\n async createReply(post: { userId: string; postId: string; postCommentId: string; gameForumId: number }, content: string) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n imgHeight: 0,\n imgWidth: 0,\n url: \"\",\n },\n ])\n const data = {\n content: content_json,\n forumId: post.gameForumId,\n postCommentId: post.postCommentId,\n postId: post.postId,\n postType: \"1\",\n toUserId: post.userId,\n }\n\n return await this._dna_request(\"forum/comment/createReply\", data, { sign: true, refer: true, params: { toUserId: post.userId } })\n }\n\n /** 回复评论的评论 */\n async createReplyList(\n post: { userId: string; postId: string; postCommentId: string; postCommentReplyId: string; gameForumId: number },\n content: string,\n ) {\n const content_json = JSON.stringify([\n {\n content,\n contentType: \"1\",\n imgHeight: 0,\n imgWidth: 0,\n url: \"\",\n },\n ])\n const data = {\n content: content_json,\n forumId: post.gameForumId,\n postCommentId: post.postCommentId,\n postCommentReplyId: post.postCommentReplyId,\n postId: post.postId,\n postType: \"1\",\n toUserId: post.userId,\n }\n return await this._dna_request(\"forum/comment/createReply\", data, { sign: true, refer: true, params: { toUserId: post.userId } })\n }\n\n /** 删 */\n async deletePost(deleteType: number, id: number) {\n return await this._dna_request(\"forum/more/delete\", { deleteType, id }, { sign: true, refer: true })\n }\n\n /**\n * 获取用户信息\n * @returns 用户信息\n */\n async getOtherMine(userId = \"709542994134436647\") {\n const data = {\n otherUserId: userId,\n searchType: 1,\n type: 2,\n }\n return await this._dna_request<DNAMineRes>(\"user/mine\", data)\n }\n\n /**\n * 获取用户信息\n * @returns 用户信息\n */\n async getMine() {\n return await this._dna_request<DNAMineRes>(\"user/mine\")\n }\n\n async getGameConfig() {\n const data = { gameId: DNA_GAME_ID }\n return await this._dna_request<DNAGameConfigRes[]>(\"config/getGameConfig\", data)\n }\n\n async getHeaders(options?: {\n payload?: Record<string, any> | string | FormData\n exparams?: Record<string, any>\n dev_code?: string\n refer?: boolean\n token?: string\n tokenSig?: boolean\n h5?: boolean\n }) {\n let { payload, exparams, dev_code = this.dev_code, refer, token = this.token, tokenSig, h5 } = options || {}\n\n const CONTENT_TYPE = \"application/x-www-form-urlencoded; charset=utf-8\"\n const iosBaseHeader = {\n version: \"1.1.3\",\n source: \"ios\",\n \"Content-Type\": CONTENT_TYPE,\n \"User-Agent\": \"DoubleHelix/4 CFNetwork/3860.100.1 Darwin/25.0.0\",\n }\n const h5BaseHeader = {\n version: \"3.11.0\",\n source: \"h5\",\n \"Content-Type\": CONTENT_TYPE,\n \"User-Agent\":\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36\",\n }\n // 默认获取ios头\n const headers = { ...(this.is_h5 || h5 ? h5BaseHeader : iosBaseHeader) } as Record<string, any>\n if (dev_code) {\n headers.devCode = dev_code\n }\n if (refer) {\n headers.origin = \"https://dnabbs.yingxiong.com\"\n headers.refer = \"https://dnabbs.yingxiong.com/\"\n }\n if (token) {\n headers.token = token\n }\n if (payload instanceof FormData) {\n const pk = await this.getRsaPublicKey()\n const { signature, key } = build_upload_signature(pk)\n headers.t = signature\n this.uploadKey = key\n\n if (exparams) {\n for (const [key, value] of Object.entries(exparams)) {\n payload.append(key, String(value))\n }\n }\n\n delete headers[\"Content-Type\"]\n } else if (typeof payload === \"object\") {\n const si = build_signature(payload, tokenSig ? token : \"\")\n Object.assign(payload, { sign: si.s, timestamp: si.t })\n if (exparams) {\n Object.assign(payload, exparams)\n }\n\n const params = new URLSearchParams()\n Object.entries(payload).forEach(([key, value]) => {\n params.append(key, String(value))\n })\n payload = params.toString()\n\n const rk = si.k\n const pk = await this.getRsaPublicKey()\n const ek = rsa_encrypt(rk, pk)\n if (this.is_h5) {\n headers.k = ek\n } else {\n headers.rk = rk\n headers.key = ek\n }\n }\n return { headers, payload }\n }\n\n private async _dna_request<T = any>(\n url: string,\n data?: any,\n options?: {\n method?: \"GET\" | \"POST\"\n sign?: boolean\n file?: File\n tokenSig?: boolean\n h5?: boolean\n token?: boolean\n refer?: boolean\n params?: Record<string, any>\n max_retries?: number\n retry_delay?: number\n timeout?: number\n },\n ): Promise<DNAApiResponse<T>> {\n let { method = \"POST\", sign, h5, refer, params, max_retries = 3, retry_delay = 1, timeout = 10000, token, tokenSig } = options || {}\n let headers: Record<string, any>\n if (sign) {\n const { payload: p, headers: h } = await this.getHeaders({\n payload: data,\n refer,\n exparams: params,\n token: token ? this.token : undefined,\n tokenSig,\n h5,\n })\n data = p\n headers = h\n } else {\n const { headers: h } = await this.getHeaders({ token: token ? this.token : undefined, refer, h5 })\n headers = h\n }\n\n for (let attempt = 0; attempt < max_retries; attempt++) {\n try {\n let body: string | FormData | undefined = data\n if (data && typeof data === \"object\" && !(data instanceof FormData)) {\n const p = new URLSearchParams()\n Object.entries(data).forEach(([key, value]) => {\n if (value !== undefined) p.append(key, String(value))\n })\n body = p.toString()\n }\n const fetchOptions: RequestInit = {\n method,\n headers,\n body,\n }\n\n // 实现超时控制\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), timeout)\n\n const initOptions = {\n ...fetchOptions,\n signal: controller.signal,\n }\n const response = this.fetchFn\n ? await this.fetchFn(`${this.BASE_URL}${url}`, initOptions)\n : await fetch(`${this.BASE_URL}${url}`, initOptions)\n clearTimeout(timeoutId)\n\n // 获取响应头的 content-type\n const contentType = response.headers.get(\"content-type\") || \"\"\n let raw_res: any\n\n // 根据 content-type 处理响应数据\n if (contentType.includes(\"text/\")) {\n const textData = await response.text()\n raw_res = {\n code: RespCode.ERROR,\n data: textData,\n }\n } else {\n raw_res = await response.json()\n }\n\n if (typeof raw_res === \"object\" && raw_res !== null) {\n try {\n if (typeof raw_res.data === \"string\") {\n raw_res.data = JSON.parse(raw_res.data)\n }\n } catch (e) {\n // 忽略解析错误\n }\n }\n\n return new DNAApiResponse<T>(raw_res)\n } catch (e) {\n console.error(`请求失败: ${(e as Error).message}`)\n if (attempt < max_retries - 1) {\n await new Promise((resolve) => setTimeout(resolve, retry_delay * Math.pow(2, attempt)))\n }\n }\n }\n\n return DNAApiResponse.err(\"请求服务器失败,已达最大重试次数\")\n }\n}\n\n//#region 接口定义\n\nexport interface DNAMineRes {\n mine: DNAMine\n postList: DNAPost[]\n hasNext: number\n}\n\nexport interface DNAMine {\n /** 文章数量 */\n articleCount: number\n /** 收藏数量 */\n collectCount: number\n /** 评论数量 */\n commentCount: number\n /** 粉丝数量 */\n fansCount: number\n /** 新粉丝数量 */\n fansNewCount: number\n /** 关注数量 */\n followCount: number\n /** 性别 */\n gender: number\n /** 精华数量 */\n goldNum: number\n /** 头像 */\n headUrl: string\n /** 是否关注 */\n isFollow: number\n /** 是否登录用户 */\n isLoginUser: number\n /** 是否被禁言 */\n isMute: number\n /** 等级 */\n levelTotal: number\n /** 点赞数量 */\n likeCount: number\n /** 手机号 */\n mobile: string\n /** 管理员列表 */\n moderatorVos: any[]\n /** 帖子数量 */\n postCount: number\n /** 注册时间 */\n registerTime: string\n /** 状态 */\n status: number\n /** 趋势数量 */\n trendCount: number\n /** 用户ID */\n userId: string\n /** 用户名 */\n userName: string\n}\n\nexport interface DNAGameConfigRes {\n /** 游戏所有板块列表 */\n gameAllForumList: GameForum[]\n /** 游戏ID */\n gameId: number\n /** 游戏板块图片列表 */\n gameForumPictureList: any[]\n /** 游戏板块列表 */\n gameForumList: GameForum[]\n /** 签到按钮图片 */\n signBtn: string\n sort: number\n /** 话题列表 */\n topicList: GameTopic[]\n /** 背景图片 */\n drawBackgroundUrl: string\n /** 是否默认游戏 */\n gameDefault: number\n /** 签到颜色 */\n signColor: string\n /** 游戏名称 */\n gameName: string\n /** CM图片2 意味不明 */\n drawListUrl: string\n /** 英文站点 */\n configTab: ConfigTab[]\n}\n\nexport interface ConfigTab {\n name: string\n url: string\n}\n\nexport interface GameTopic {\n /** 话题背景图片 */\n backgroundUrl: string\n gameId: number\n /** 话题图标 */\n topicIconUrl: string\n topicId: number\n /** 话题名称 */\n topicName: string\n sort: number\n /** 话题描述 */\n topicDesc: string\n}\n\nexport interface GameForum {\n /** 全部=1 普通=3 */\n forumDataType: number\n /** 固定1 */\n forumUiType: number\n /** 小红点 */\n isTrend: number\n /** 夜间模式图标 */\n iconWhiteUrl: string\n /** 固定1 */\n forumType: number\n /** 板块名称 */\n name: string\n forumListShowType: number\n /** 图标 */\n iconUrl: string\n id: number\n sort: number\n /** 官方 */\n isOfficial: number\n}\n\nexport interface UserGame {\n gameId: number // gameId\n gameName: string // gameName\n}\n\nexport interface DNAEmoji {\n content: string[]\n gameId: number\n icon: string\n size: number\n title: string\n url: string\n}\n\nexport interface DNACommonConfigRes {\n logBehaviorConfigVo: DNALogBehaviorConfigVo\n signApiConfigVo: DNASignApiConfigVo\n vodOssConfig: DNAVodOssConfig\n}\n\nexport interface DNAVodOssConfig {\n endPoint: string\n uploadSizeLimit: string\n}\n\nexport interface DNASignApiConfigVo {\n /**\n * 签名API列表\n * e.g. [\n \"/user/sdkLogin\",\n \"/forum/postPublish\",\n \"/forum/comment/createComment\",\n \"/forum/comment/createReply\",\n \"/user/getSmsCode\",\n \"/role/defaultRoleForTool\",\n \"/media/av/cfg/getVideos\",\n \"/media/av/cfg/getAudios\",\n \"/media/av/cfg/getImages\"\n ]\n */\n signApiList: string[]\n}\n\n//#region 地图相关\nexport interface DNAMapMatterCategorizeOption {\n icon: string\n id: number\n matters: DNAMapMatter[]\n name: string\n sort?: number\n}\nexport interface DNAMatterCategorizeDetail {\n icon: string\n id: number\n matters: DNAMapMatterDetail[]\n name: string\n sort?: number\n}\n\nexport interface DNAMapMatter {\n icon: string\n id: number\n mapMatterCategorizeId: number\n name: string\n sort: number\n}\n\nexport interface DNAMapCategorizeListRes {\n list: DNAMatterCategorizeList[]\n}\n\nexport interface DNAMatterCategorizeList {\n id: number\n maps: DNAMap[]\n name: string\n}\n\nexport interface DNALogBehaviorConfigVo {\n freq: number\n onAndOff: number\n}\n\nexport interface DNAMapDetailRes {\n floors: DNAMapFloor[]\n matterCategorizes: DNAMatterCategorizeDetail[]\n map: DNAMap\n userSites: DNAMapSite[]\n}\n\nexport interface DNAMap {\n id: number\n name: string\n pid?: number\n}\n\nexport interface DNAMapMatterDetail extends DNAMapMatter {\n sites: DNAMapSite[]\n}\n\nexport interface DNAMapSite {\n id: number\n isHide: number\n mapFloorId: number\n mapId: number\n mapMatterId: number\n x: number\n y: number\n}\n\nexport interface DNAMapFloor {\n floor: number\n id: number\n name: string\n pic: string\n}\n\nexport interface DNAMapSiteDetailRes {\n contributes: Contribute[]\n description: string\n id: number\n isDel: number\n isHide: number\n mapFloorId: number\n mapId: number\n mapMatterCategorizeId: number\n mapMatterId: number\n pic: string\n script: string\n url: string\n urlDesc: string\n urlIcon: string\n x: number\n y: number\n}\n\ninterface Contribute {\n userHeadUrl: string\n userId: string\n userName: string\n}\n//#endregion\n\nexport interface DNALoginRes {\n applyCancel?: number // applyCancel\n gender?: number // gender\n signature?: string // signature\n headUrl: string // headUrl\n userName: string // userName\n userId: string // userId\n isOfficial: number // isOfficial\n token: string // token\n userGameList: UserGame[] // userGameList\n isRegister: number // isRegister\n status: number // status\n /** 是否完成绑定 0: 未绑定, 1: 已绑定 */\n isComplete: number\n refreshToken: string // refreshToken\n}\n\nexport interface DNARoleShowVo {\n roleId: string // roleId\n headUrl?: string // headUrl\n level?: number // level\n roleName?: string // roleName\n isDefault?: number // isDefault\n roleRegisterTime?: string // roleRegisterTime\n boundType?: number // boundType\n roleBoundId: string // roleBoundId\n}\n\nexport interface DNARole {\n gameName: string // gameName\n showVoList: DNARoleShowVo[] // showVoList\n gameId: number // gameId\n}\n\nexport interface DNARoleListRes {\n roles: DNARole[] // roles\n}\n\n/** 密函 */\nexport interface DNARoleForToolInstance {\n id: number\n /** 中文 */\n name: string\n /** 密函编码 */\n code: string\n /** 固定0 */\n on: number\n}\n\nexport interface DNARoleForToolInstanceInfo {\n /** 密函列表 */\n instances: DNARoleForToolInstance[] // instances\n}\n\nexport interface DraftDoingInfo {\n draftCompleteNum: number // draftCompleteNum\n draftDoingNum: number // draftDoingNum\n /** 结束时间 */\n endTime: string\n /** 产品id */\n productId?: number\n /** 产品名称 */\n productName: string\n /** 开始时间 */\n startTime: string\n}\n\nexport interface DraftInfo {\n /** 正在做的锻造 */\n draftDoingInfo?: DraftDoingInfo[]\n /** 正在做的锻造数量 */\n draftDoingNum: number\n /** 最大锻造数量 */\n draftMaxNum: number\n}\n\nexport interface DNARoleShortNoteRes {\n /** 迷津进度 */\n rougeLikeRewardCount: number\n /** 迷津总数 */\n rougeLikeRewardTotal: number\n /** 备忘手记进度 */\n currentTaskProgress: number\n /** 备忘手记总数 */\n maxDailyTaskProgress: number\n /** 梦魇进度 */\n hardBossRewardCount: number\n /** 梦魇总数 */\n hardBossRewardTotal: number\n /** 锻造信息 */\n draftInfo: DraftInfo\n}\n\nexport interface DNARoleWeapon {\n weaponId: number\n weaponEid: string\n /** 武器类型图标 */\n elementIcon: string\n /** 武器图标 */\n icon: string\n /** 武器等级 */\n level: number\n /** 武器名称 */\n name: string\n /** 精炼等级 */\n skillLevel: number\n /** 是否解锁 */\n unLocked: boolean\n}\n\nexport interface DNARoleChar {\n charId: number\n charEid: string\n /** 元素图标 */\n elementIcon: string\n /** 命座等级 */\n gradeLevel: number\n /** 角色图标 */\n icon: string\n /** 角色等级 */\n level: number\n /** 角色名称 */\n name: string\n /** 是否解锁 */\n unLocked: boolean\n}\n\nexport interface DNARoleForToolRes {\n /** 角色信息 */\n roleInfo: DNARoleInfo\n /** 密函 */\n instanceInfo: DNARoleForToolInstanceInfo[]\n}\n\nexport interface DNARoleShow {\n /** 角色列表 */\n roleChars: DNARoleChar[]\n /** 武器列表 */\n langRangeWeapons: DNARoleWeapon[]\n /** 武器列表 */\n closeWeapons: DNARoleWeapon[]\n /** 角色头像 */\n headUrl: string\n /** 等级 */\n level: number\n /** 成就列表 */\n params: DNARoleAchievement[]\n /** 角色id */\n roleId: string\n /** 角色名称 */\n roleName: string\n /** 迷津 */\n rougeLikeInfo: DNARougeLikeInfo\n}\n\nexport interface DNARoleAchievement {\n paramKey: string // paramKey\n paramValue: string // paramValue\n}\n\nexport interface DNARoleInfo {\n /** 深渊信息 */\n abyssInfo: DNAAbyssInfo\n /** 角色信息 */\n roleShow: DNARoleShow\n}\n\nexport interface DNARougeLikeInfo {\n /** 最大通过等级 */\n maxPassed: number\n /** 最大通过等级名称 */\n maxPassedName: string\n /** 重置时间 */\n resetTime: string\n /** 奖励数量 */\n rewardCount: number\n /** 奖励总数 */\n rewardTotal: number\n /** 天赋信息 */\n talentInfo: DNARougeLikeTalentInfo[]\n}\n\nexport interface DNARougeLikeTalentInfo {\n cur: string\n max: string\n}\n\nexport interface DNAAbyssInfo {\n /** 阵容 */\n bestTimeVo1: DNABestTimeVo1\n /** 结束时间 */\n endTime: string\n /** 操作名称 */\n operaName: string\n /** 进度名称 */\n progressName: string\n /** 星级 */\n stars: string\n /** 开始时间 */\n startTime: string\n}\n\n/** 深渊阵容 */\nexport interface DNABestTimeVo1 {\n /** 角色图标 */\n charIcon: string\n /** 近战武器图标 */\n closeWeaponIcon: string\n /** 远程武器图标 */\n langRangeWeaponIcon: string\n /** 魔灵图标 */\n petIcon: string\n /** 协战角色图标1 */\n phantomCharIcon1: string\n /** 协战武器图标1 */\n phantomWeaponIcon1: string\n /** 协战角色图标2 */\n phantomCharIcon2: string\n /** 协战武器图标2 */\n phantomWeaponIcon2: string\n}\n\n/** 角色属性 */\nexport interface DNACharAttribute {\n /** 技能范围 */\n skillRange: string\n /** 强化值 */\n strongValue: string\n /** 技能威力 */\n skillIntensity: string\n /** 武器精通 */\n weaponTags: string[]\n /** 防御 */\n def: number\n /** 仇恨值 */\n enmityValue: string\n /** 技能效益 */\n skillEfficiency: string\n /** 技能耐久 */\n skillSustain: string\n /** 最大生命值 */\n maxHp: number\n /** 攻击 */\n atk: number\n /** 最大护盾 */\n maxES: number\n /** 最大神志 */\n maxSp: number\n}\n\n/** 角色技能 */\nexport interface DNARoleSkill {\n /** 技能id */\n skillId: number\n /** 技能图标 */\n icon: string\n /** 技能等级 */\n level: number\n /** 技能名称 */\n skillName: string\n}\n\n/** 溯源 */\nexport interface DNARoleTrace {\n /** 溯源图标 */\n icon: string\n /** 溯源描述 */\n description: string\n}\n\n/** 魔之楔 */\nexport interface DNARoleMod {\n /** id 没佩戴为-1 */\n id: number\n /** 图标 */\n icon?: string\n /** 质量 */\n quality?: number\n /** 名称 */\n name?: string\n}\n\nexport interface DNACharDetail {\n charId: number\n /** 角色属性 */\n attribute: DNACharAttribute\n /** 角色技能 */\n skills: DNARoleSkill[]\n /** 立绘 */\n paint: string\n /** 角色名称 */\n charName: string\n /** 元素图标 */\n elementIcon: string\n /** 溯源 */\n traces: DNARoleTrace[]\n /** 当前魔之楔 */\n currentVolume: number\n /** 最大魔之楔 */\n sumVolume: number\n /** 角色等级 */\n level: number\n /** 角色头像 */\n icon: string\n /** 溯源等级 0-6 */\n gradeLevel: number\n /** 元素名称 */\n elementName: string\n /** 魔之楔列表 */\n modes: DNARoleMod[]\n}\n\nexport interface DNACharDetailRes {\n /** 角色详情 */\n charDetail: DNACharDetail\n}\n\nexport interface DNAWeaponDetailRes {\n /** 武器详情 */\n weaponDetail: DNAWeaponDetail\n}\n\nexport interface DNAWeaponDetail {\n attribute: DNAWeaponAttribute\n currentVolume: number\n description: string\n elementIcon: string\n elementName: string\n icon: string\n id: number\n level: number\n modes: DNARoleMod[]\n name: string\n skillLevel: number\n sumVolume: number\n}\n\nexport interface DNAWeaponAttribute {\n atk: number\n crd: number\n cri: number\n speed: number\n trigger: number\n}\n\nexport interface DNADayAward {\n gameId: number // gameId\n periodId: number // periodId\n iconUrl: string // iconUrl\n id: number // id\n dayInPeriod: number // dayInPeriod\n updateTime: number // updateTime\n awardNum: number // awardNum\n thirdProductId: string // thirdProductId\n createTime: number // createTime\n awardName: string // awardName\n}\n\nexport interface DNACaSignPeriod {\n gameId: number // gameId\n retryCos: number // retryCos\n endDate: number // endDate\n id: number // id\n startDate: number // startDate\n retryTimes: number // retryTimes\n overDays: number // overDays\n createTime: number // createTime\n name: string // name\n}\n\nexport interface DNACaSignRoleInfo {\n headUrl: string // headUrl\n roleId: string // roleId\n roleName: string // roleName\n level: number // level\n roleBoundId: string // roleBoundId\n}\n\nexport interface DNAHaveSignInRes {\n /** 已签到天数 */\n totalSignInDay: number\n}\n\nexport interface DNACalendarSignRes {\n todaySignin: boolean // todaySignin\n userGoldNum: number // userGoldNum\n dayAward: DNADayAward[] // dayAward\n signinTime: number // signinTime\n period: DNACaSignPeriod // period\n roleInfo: DNACaSignRoleInfo // roleInfo\n}\n\nexport interface DNABBSTask {\n /** 备注 */\n remark: string\n /** 完成次数 */\n completeTimes: number\n /** 需要次数 */\n times: number\n /** skipType */\n skipType: number\n /** 获取经验 */\n gainExp: number\n /** 进度 */\n process: number\n /** 获取金币 */\n gainGold: number\n /** 任务标识名 */\n markName?: string\n}\n\nexport interface DNATaskProcessRes {\n dailyTask: DNABBSTask[] // dailyTask\n}\n\nexport interface DNATopicPostListRes {\n postList: DNAPost[]\n topic: DNATopicDetail\n hasNext: number\n}\n\nexport interface DNATopicDetail {\n backgroundUrl: string\n gameId: number\n sort: number\n topicDesc: string\n topicIconUrl: string\n topicId: number\n topicName: string\n}\n\nexport interface DNAPost {\n browseCount: string\n collectionCount: number\n commentCount: number\n gameForumId: number\n gameId: number\n gameName: string\n imgContent: DNAPostImgContent[]\n imgCount: number\n isCollect: number\n isCreator: number\n isElite: number\n isFollow: number\n isLike: number\n isLock: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n postContent: string\n postCover: string\n postCoverVo: DNAPostCoverVo\n postId: string\n postStatus: number\n postTitle: string\n postType: number\n showTime: string\n topics: DNATopicShort[]\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNATopicShort {\n topicId: number\n topicName: string\n}\n\nexport interface DNAPostCoverVo {\n imgHeight: number\n imgWidth: number\n}\n\nexport interface DNAPostImgContent {\n imgHeight: number\n imgWidth: number\n url: string\n isAbnormal?: boolean\n}\n\nexport interface DNAPostListRes {\n postList: DNAPost[] // posts\n topList: any[]\n hasNext: number\n}\n\nexport interface DNAPostDetailRes {\n isHotCount: boolean\n gameId: number\n isFollow: number\n isLike: number\n postDetail: DNAPostDetail\n isCollect: number\n hasNext: number\n comment: DNAComment[]\n}\n\nexport interface DNAPostDetail {\n auditStatus: number\n browseCount: string\n checkStatus: number\n collectionCount: number\n commentCount: number\n gameForumId: number\n gameForumVo: DNAGameForumVo\n gameId: number\n gameName: string\n headCodeUrl: string\n id: string\n isCreator: number\n isElite: number\n isForceRecommend: number\n isHide: number\n isLock: number\n isMine: number\n isOfficial: number\n isRecommend: number\n isTop: number\n lastEditorTime?: string\n likeCount: number\n postContent: DNAPostContent[]\n postH5Content: string\n postTime: string\n postTitle: string\n postType: number\n postUserId: string\n refreshHour: number\n score: number\n topics: DNATopicShort[]\n userHeadCode: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n whiteUrl: any[]\n}\n\nexport interface DNAPostContent {\n contentType: PostContentType\n imgHeight: number\n imgWidth: number\n url?: string\n content?: string\n contentVideo?: DNAPostContentVideo\n}\n\nexport interface DNAComment {\n checkStatus: number\n commentContent: DNAPostContent[]\n commentId: string\n commentTime: string\n contentTextStatus: number\n floor: number\n isCreator: number\n isLike: number\n isMine: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n replyCount: number\n replyVos: DNAReplyVos[]\n userHeadCode?: string\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNAReplyVos {\n checkStatus: number\n contentTextStatus: number\n createTime: number\n isCreator: number\n isLike: number\n isMine: number\n isOfficial: number\n isPublisher: number\n likeCount: number\n postCommentId: string\n postCommentReplayId: string\n replyContent: DNAPostContent[]\n replyContentStr: string\n replyId: string\n replyTime: string\n toUserIsCreator: number\n toUserModeratorIdentity: number\n toUserName: string\n userHeadCode?: string\n userHeadUrl: string\n userId: string\n userLevel: number\n userModeratorIdentity: number\n userName: string\n}\n\nexport interface DNAGameForumVo {\n forumDataType: number\n forumListShowType: number\n forumType: number\n forumUiType: number\n iconUrl: string\n iconWhiteUrl: string\n id: number\n isOfficial: number\n isTrend: number\n name: string\n sort: number\n}\n\nexport enum PostContentType {\n TEXT = 1,\n IMAGE = 2,\n VIDEO = 5,\n}\n\nexport interface DNAPostContentVideo {\n videoUrl: string // videoUrl\n coverUrl?: string // coverUrl\n}\n\nclass DNAApiResponse<T = any> {\n code: number = 0\n msg: string = \"\"\n success: boolean = false\n data?: T\n\n constructor(raw_data: any) {\n this.code = raw_data.code || 0\n this.msg = raw_data.msg || \"\"\n this.success = raw_data.success || false\n this.data = raw_data.data\n }\n\n // 判断是否成功\n get is_success() {\n return this.success && [RespCode.OK_ZERO, RespCode.OK_HTTP].includes(this.code)\n }\n\n // 错误响应静态方法\n static err<T = undefined>(msg: string, code: number = RespCode.ERROR): DNAApiResponse<T> {\n return new DNAApiResponse<T>({ code, msg, data: undefined, success: false })\n }\n}\n//#endregion\n\n//#region utils\n\n// RSA加密函数\nfunction rsa_encrypt(text: string, public_key_b64: string): string {\n try {\n // 将base64公钥转换为PEM格式\n const lines: string[] = []\n for (let i = 0; i < public_key_b64.length; i += 64) {\n lines.push(public_key_b64.slice(i, i + 64))\n }\n const pem = `-----BEGIN PUBLIC KEY-----\\n${lines.join(\"\\n\")}\\n-----END PUBLIC KEY-----`\n\n // 导入PEM格式的RSA公钥\n const publicKey = forge.pki.publicKeyFromPem(pem)\n\n // 执行PKCS1_v1_5加密\n const textBytes = forge.util.encodeUtf8(text)\n const encrypted = publicKey.encrypt(textBytes)\n\n return forge.util.encode64(encrypted)\n } catch (e) {\n throw new Error(`[DNA] RSA 加密失败: ${(e as Error).message}`)\n }\n}\n\n// 生成随机字符串\nfunction rand_str(length: number = 16): string {\n const chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length))\n }\n return result\n}\n\n// MD5加密并转换为大写\nfunction md5_upper(text: string): string {\n const md = forge.md.md5.create()\n md.update(text)\n return md.digest().toHex().toUpperCase()\n}\n\n// 签名哈希函数\nfunction signature_hash(text: string): string {\n function swap_positions(text: string, positions: number[]): string {\n const chars = text.split(\"\")\n for (let i = 1; i < positions.length; i += 2) {\n const p1 = positions[i - 1]\n const p2 = positions[i]\n if (p1 >= 0 && p1 < chars.length && p2 >= 0 && p2 < chars.length) {\n ;[chars[p1], chars[p2]] = [chars[p2], chars[p1]]\n }\n }\n return chars.join(\"\")\n }\n return swap_positions(md5_upper(text), [1, 13, 5, 17, 7, 23])\n}\n\n// 签名函数\nfunction sign_fI(data: Record<string, any>, secret: string): string {\n const pairs: string[] = []\n const sortedKeys = Object.keys(data).sort()\n for (const k of sortedKeys) {\n const v = data[k]\n if (v !== null && v !== undefined && v !== \"\") {\n pairs.push(`${k}=${v}`)\n }\n }\n const qs = pairs.join(\"&\")\n return signature_hash(`${qs}&${secret}`)\n}\n\n// XOR编码函数\nfunction xor_encode(text: string, key: string): string {\n const encoder = new TextEncoder()\n const tb = encoder.encode(text)\n const kb = encoder.encode(key)\n const out: string[] = []\n for (let i = 0; i < tb.length; i++) {\n const b = tb[i]\n const e = (b & 255) + (kb[i % kb.length] & 255)\n out.push(`@${e}`)\n }\n return out.join(\"\")\n}\n\n// 上传图片签名 - 字符交换\nfunction swapForUploadImgApp(text: string): string {\n const chars = text.split(\"\")\n const swaps = [\n [3, 23],\n [11, 32],\n [22, 42],\n [25, 48],\n ]\n for (const [p1, p2] of swaps) {\n if (p1 < chars.length && p2 < chars.length) {\n ;[chars[p1], chars[p2]] = [chars[p2], chars[p1]]\n }\n }\n return chars.join(\"\")\n}\n\n// AES 解密图片 URL\nfunction aesDecryptImageUrl(encryptedUrl: string, key: string): string {\n const swapped = swapForUploadImgApp(encryptedUrl)\n\n const encryptedData = forge.util.decode64(swapped)\n\n const decipher = forge.cipher.createDecipher(\"AES-CBC\", key)\n decipher.start({ iv: \"A-16-Byte-String\" })\n decipher.update(forge.util.createBuffer(encryptedData))\n decipher.finish()\n\n return decipher.output.getBytes()\n}\n\n// 构建上传图片签名(返回签名和密钥)\nfunction build_upload_signature(public_key: string): { signature: string; key: string } {\n const key = rand_str(16)\n const encrypted = rsa_encrypt(key, public_key)\n const signature = swapForUploadImgApp(encrypted)\n return { signature, key }\n}\n\n// 构建普通签名\nfunction build_signature(data: Record<string, any>, token?: string): Record<string, any> {\n const ts = Date.now()\n const sign_data = { ...data, timestamp: ts, token }\n const sec = rand_str(16)\n const sig = sign_fI(sign_data, sec)\n const enc = xor_encode(sig, sec)\n return { s: enc, t: ts, k: sec }\n}\n//#endregion\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "AAAA,6BAUA,IAAM,EAAc,IAMb,MAAM,CAAO,CAmBL,SACA,MAnBJ,QACA,MAAQ,GACR,eACH,2NACG,SAAW,oCACV,UAAoB,GAY5B,WAAW,CACA,EACA,EAAQ,GACf,EAAgF,CAAC,EACnF,CAHS,gBACA,aAIP,GADA,KAAK,QAAU,EAAQ,QACnB,EAAQ,QAAU,OAAW,KAAK,MAAQ,EAAQ,MACtD,GAAI,EAAQ,iBAAmB,OAAW,KAAK,e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1C,EAAsB,OAAK,SAAS,CAAO,EAE3C,EAAiB,SAAO,eAAe,UAAW,CAAG,EAK3D,OAJA,EAAS,MAAM,CAAE,GAAI,kBAAmB,CAAC,EACzC,EAAS,OAAa,OAAK,aAAa,CAAa,CAAC,EACtD,EAAS,OAAO,EAET,EAAS,OAAO,SAAS,EAIpC,SAAS,CAAsB,CAAC,EAAwD,CACpF,IAAM,EAAM,EAAS,EAAE,EACjB,EAAY,EAAY,EAAK,CAAU,EAE7C,MAAO,CAAE,UADS,EAAoB,CAAS,EAC3B,KAAI,EAI5B,SAAS,CAAe,CAAC,EAA2B,EAAqC,CACrF,IAAM,EAAK,KAAK,IAAI,EACd,EAAY,IAAK,EAAM,UAAW,EAAI,OAAM,EAC5C,EAAM,EAAS,EAAE,EACjB,EAAM,EAAQ,EAAW,CAAG,EAElC,MAAO,CAAE,EADG,EAAW,EAAK,CAAG,EACd,EAAG,EAAI,EAAG,CAAI",
|
|
8
|
+
"debugId": "496FD8ABF189780464756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dna-api",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "dna bbs api",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "pa001024",
|
|
7
|
-
"url": "https://github.com/pa001024",
|
|
8
|
-
"email": "pa001024@qq.com"
|
|
9
|
-
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"module": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
"bun": "./dist/index.js",
|
|
15
|
-
"node": "./dist/index.js",
|
|
16
|
-
"require": "./dist/index.js",
|
|
17
|
-
"import": "./dist/index.js",
|
|
18
|
-
"default": "./dist/index.js",
|
|
19
|
-
"types": "./dist/index.d.ts"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"dna",
|
|
23
|
-
"api"
|
|
24
|
-
],
|
|
25
|
-
"homepage": "https://github.com/pa001024/dna-builder",
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "://github.com/pa001024/dna-builder"
|
|
29
|
-
},
|
|
30
|
-
"bugs": "://github.com/pa001024/dna-builder/issues",
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"scripts": {
|
|
33
|
-
"test": "bun test && npm run test:types",
|
|
34
|
-
"test:types": "tsc --project tsconfig.test.json",
|
|
35
|
-
"build": "rimraf dist && bun build.ts && tsc --project tsconfig.build.json",
|
|
36
|
-
"release": "npm run build && npm publish --access public",
|
|
37
|
-
"trace": "tsc --generateTrace ./trace --incremental false"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"node-forge": "^1.3.1"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@types/node": "^25.0.3",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"typescript": "^5.1.6"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dna-api",
|
|
3
|
+
"version": "0.2.9",
|
|
4
|
+
"description": "dna bbs api",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "pa001024",
|
|
7
|
+
"url": "https://github.com/pa001024",
|
|
8
|
+
"email": "pa001024@qq.com"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"bun": "./dist/index.js",
|
|
15
|
+
"node": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.js",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"dna",
|
|
23
|
+
"api"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/pa001024/dna-builder",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "://github.com/pa001024/dna-builder"
|
|
29
|
+
},
|
|
30
|
+
"bugs": "://github.com/pa001024/dna-builder/issues",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "bun test && npm run test:types",
|
|
34
|
+
"test:types": "tsc --project tsconfig.test.json",
|
|
35
|
+
"build": "rimraf dist && bun build.ts && tsc --project tsconfig.build.json",
|
|
36
|
+
"release": "npm run build && npm publish --access public",
|
|
37
|
+
"trace": "tsc --generateTrace ./trace --incremental false"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"node-forge": "^1.3.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^25.0.3",
|
|
44
|
+
"bun-types": "^1.3.5",
|
|
45
|
+
"rimraf": "6.1.2",
|
|
46
|
+
"typescript": "^5.1.6"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/api.test.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test"
|
|
2
|
+
import { DNAAPI } from "."
|
|
3
|
+
|
|
4
|
+
describe("隐写技术测试", () => {
|
|
5
|
+
const api = new DNAAPI("", "", { fetchFn: fetch })
|
|
6
|
+
|
|
7
|
+
it("应该能够编码和解码基本验证码", async () => {
|
|
8
|
+
const categorizeList = await api.getMapCategorizeList()
|
|
9
|
+
console.log(categorizeList)
|
|
10
|
+
expect(categorizeList.success).toBe(true)
|
|
11
|
+
})
|
|
12
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,46 @@ export class DNAAPI {
|
|
|
61
61
|
return this.RSA_PUBLIC_KEY
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* 获取通用配置
|
|
66
|
+
*/
|
|
67
|
+
async getCommonConfig() {
|
|
68
|
+
return await this._dna_request<DNACommonConfigRes>("config/getCommonConfig")
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 获取地图标点分类
|
|
73
|
+
*/
|
|
74
|
+
async getMapMatterCategorizeOptions() {
|
|
75
|
+
return await this._dna_request<DNAMapMatterCategorizeOption[]>("map/matter/categorize/getOptions", undefined, {
|
|
76
|
+
refer: true,
|
|
77
|
+
h5: true,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 获取地图列表
|
|
83
|
+
*/
|
|
84
|
+
async getMapCategorizeList() {
|
|
85
|
+
return await this._dna_request<DNAMapCategorizeListRes>("map/categorize/list", undefined, { refer: true, h5: true })
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 获取地图详情
|
|
90
|
+
* @param id 地图ID (getMapCategorizeList().list[].maps[].id)
|
|
91
|
+
*/
|
|
92
|
+
async getMapDetail(id: number) {
|
|
93
|
+
return await this._dna_request<DNAMapDetailRes>("map/detail", { id }, { refer: true, h5: true })
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 获取地图标点详情
|
|
98
|
+
* @param id 标点ID (getMapDetail().matterCategorizes[].matters[].sites[].id)
|
|
99
|
+
*/
|
|
100
|
+
async getMapSiteDetail(id: number) {
|
|
101
|
+
return await this._dna_request<DNAMapSiteDetailRes>("map/site/detail", { id }, { refer: true, h5: true })
|
|
102
|
+
}
|
|
103
|
+
|
|
64
104
|
/**
|
|
65
105
|
* 登录
|
|
66
106
|
*/
|
|
@@ -111,6 +151,13 @@ export class DNAAPI {
|
|
|
111
151
|
return res
|
|
112
152
|
}
|
|
113
153
|
|
|
154
|
+
/**
|
|
155
|
+
* 获取Emoji列表
|
|
156
|
+
*/
|
|
157
|
+
async getEmojiList() {
|
|
158
|
+
return await this._dna_request<DNAEmoji[]>("config/getEmoji")
|
|
159
|
+
}
|
|
160
|
+
|
|
114
161
|
/**
|
|
115
162
|
* 获取登录日志
|
|
116
163
|
*/
|
|
@@ -642,8 +689,9 @@ export class DNAAPI {
|
|
|
642
689
|
refer?: boolean
|
|
643
690
|
token?: string
|
|
644
691
|
tokenSig?: boolean
|
|
692
|
+
h5?: boolean
|
|
645
693
|
}) {
|
|
646
|
-
let { payload, exparams, dev_code = this.dev_code, refer, token = this.token, tokenSig } = options || {}
|
|
694
|
+
let { payload, exparams, dev_code = this.dev_code, refer, token = this.token, tokenSig, h5 } = options || {}
|
|
647
695
|
|
|
648
696
|
const CONTENT_TYPE = "application/x-www-form-urlencoded; charset=utf-8"
|
|
649
697
|
const iosBaseHeader = {
|
|
@@ -660,7 +708,7 @@ export class DNAAPI {
|
|
|
660
708
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
|
|
661
709
|
}
|
|
662
710
|
// 默认获取ios头
|
|
663
|
-
const headers = { ...(this.is_h5 ? h5BaseHeader : iosBaseHeader) } as Record<string, any>
|
|
711
|
+
const headers = { ...(this.is_h5 || h5 ? h5BaseHeader : iosBaseHeader) } as Record<string, any>
|
|
664
712
|
if (dev_code) {
|
|
665
713
|
headers.devCode = dev_code
|
|
666
714
|
}
|
|
@@ -718,6 +766,7 @@ export class DNAAPI {
|
|
|
718
766
|
sign?: boolean
|
|
719
767
|
file?: File
|
|
720
768
|
tokenSig?: boolean
|
|
769
|
+
h5?: boolean
|
|
721
770
|
token?: boolean
|
|
722
771
|
refer?: boolean
|
|
723
772
|
params?: Record<string, any>
|
|
@@ -726,7 +775,7 @@ export class DNAAPI {
|
|
|
726
775
|
timeout?: number
|
|
727
776
|
},
|
|
728
777
|
): Promise<DNAApiResponse<T>> {
|
|
729
|
-
let { method = "POST", sign, refer, params, max_retries = 3, retry_delay = 1, timeout = 10000, token, tokenSig } = options || {}
|
|
778
|
+
let { method = "POST", sign, h5, refer, params, max_retries = 3, retry_delay = 1, timeout = 10000, token, tokenSig } = options || {}
|
|
730
779
|
let headers: Record<string, any>
|
|
731
780
|
if (sign) {
|
|
732
781
|
const { payload: p, headers: h } = await this.getHeaders({
|
|
@@ -735,11 +784,12 @@ export class DNAAPI {
|
|
|
735
784
|
exparams: params,
|
|
736
785
|
token: token ? this.token : undefined,
|
|
737
786
|
tokenSig,
|
|
787
|
+
h5,
|
|
738
788
|
})
|
|
739
789
|
data = p
|
|
740
790
|
headers = h
|
|
741
791
|
} else {
|
|
742
|
-
const { headers: h } = await this.getHeaders({ token: token ? this.token : undefined })
|
|
792
|
+
const { headers: h } = await this.getHeaders({ token: token ? this.token : undefined, refer, h5 })
|
|
743
793
|
headers = h
|
|
744
794
|
}
|
|
745
795
|
|
|
@@ -810,19 +860,6 @@ export class DNAAPI {
|
|
|
810
860
|
}
|
|
811
861
|
}
|
|
812
862
|
|
|
813
|
-
enum DNAInstanceMHType {
|
|
814
|
-
"角色" = "role",
|
|
815
|
-
"武器" = "weapon",
|
|
816
|
-
"魔之楔" = "mzx",
|
|
817
|
-
"role" = "角色",
|
|
818
|
-
"weapon" = "武器",
|
|
819
|
-
"mzx" = "魔之楔",
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
export function getDNAInstanceMHType(key: keyof typeof DNAInstanceMHType) {
|
|
823
|
-
return DNAInstanceMHType[key]
|
|
824
|
-
}
|
|
825
|
-
|
|
826
863
|
//#region 接口定义
|
|
827
864
|
|
|
828
865
|
export interface DNAMineRes {
|
|
@@ -952,6 +989,143 @@ export interface UserGame {
|
|
|
952
989
|
gameName: string // gameName
|
|
953
990
|
}
|
|
954
991
|
|
|
992
|
+
export interface DNAEmoji {
|
|
993
|
+
content: string[]
|
|
994
|
+
gameId: number
|
|
995
|
+
icon: string
|
|
996
|
+
size: number
|
|
997
|
+
title: string
|
|
998
|
+
url: string
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export interface DNACommonConfigRes {
|
|
1002
|
+
logBehaviorConfigVo: DNALogBehaviorConfigVo
|
|
1003
|
+
signApiConfigVo: DNASignApiConfigVo
|
|
1004
|
+
vodOssConfig: DNAVodOssConfig
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
export interface DNAVodOssConfig {
|
|
1008
|
+
endPoint: string
|
|
1009
|
+
uploadSizeLimit: string
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export interface DNASignApiConfigVo {
|
|
1013
|
+
/**
|
|
1014
|
+
* 签名API列表
|
|
1015
|
+
* e.g. [
|
|
1016
|
+
"/user/sdkLogin",
|
|
1017
|
+
"/forum/postPublish",
|
|
1018
|
+
"/forum/comment/createComment",
|
|
1019
|
+
"/forum/comment/createReply",
|
|
1020
|
+
"/user/getSmsCode",
|
|
1021
|
+
"/role/defaultRoleForTool",
|
|
1022
|
+
"/media/av/cfg/getVideos",
|
|
1023
|
+
"/media/av/cfg/getAudios",
|
|
1024
|
+
"/media/av/cfg/getImages"
|
|
1025
|
+
]
|
|
1026
|
+
*/
|
|
1027
|
+
signApiList: string[]
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
//#region 地图相关
|
|
1031
|
+
export interface DNAMapMatterCategorizeOption {
|
|
1032
|
+
icon: string
|
|
1033
|
+
id: number
|
|
1034
|
+
matters: DNAMapMatter[]
|
|
1035
|
+
name: string
|
|
1036
|
+
sort?: number
|
|
1037
|
+
}
|
|
1038
|
+
export interface DNAMatterCategorizeDetail {
|
|
1039
|
+
icon: string
|
|
1040
|
+
id: number
|
|
1041
|
+
matters: DNAMapMatterDetail[]
|
|
1042
|
+
name: string
|
|
1043
|
+
sort?: number
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export interface DNAMapMatter {
|
|
1047
|
+
icon: string
|
|
1048
|
+
id: number
|
|
1049
|
+
mapMatterCategorizeId: number
|
|
1050
|
+
name: string
|
|
1051
|
+
sort: number
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
export interface DNAMapCategorizeListRes {
|
|
1055
|
+
list: DNAMatterCategorizeList[]
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export interface DNAMatterCategorizeList {
|
|
1059
|
+
id: number
|
|
1060
|
+
maps: DNAMap[]
|
|
1061
|
+
name: string
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
export interface DNALogBehaviorConfigVo {
|
|
1065
|
+
freq: number
|
|
1066
|
+
onAndOff: number
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
export interface DNAMapDetailRes {
|
|
1070
|
+
floors: DNAMapFloor[]
|
|
1071
|
+
matterCategorizes: DNAMatterCategorizeDetail[]
|
|
1072
|
+
map: DNAMap
|
|
1073
|
+
userSites: DNAMapSite[]
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
export interface DNAMap {
|
|
1077
|
+
id: number
|
|
1078
|
+
name: string
|
|
1079
|
+
pid?: number
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
export interface DNAMapMatterDetail extends DNAMapMatter {
|
|
1083
|
+
sites: DNAMapSite[]
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
export interface DNAMapSite {
|
|
1087
|
+
id: number
|
|
1088
|
+
isHide: number
|
|
1089
|
+
mapFloorId: number
|
|
1090
|
+
mapId: number
|
|
1091
|
+
mapMatterId: number
|
|
1092
|
+
x: number
|
|
1093
|
+
y: number
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export interface DNAMapFloor {
|
|
1097
|
+
floor: number
|
|
1098
|
+
id: number
|
|
1099
|
+
name: string
|
|
1100
|
+
pic: string
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
export interface DNAMapSiteDetailRes {
|
|
1104
|
+
contributes: Contribute[]
|
|
1105
|
+
description: string
|
|
1106
|
+
id: number
|
|
1107
|
+
isDel: number
|
|
1108
|
+
isHide: number
|
|
1109
|
+
mapFloorId: number
|
|
1110
|
+
mapId: number
|
|
1111
|
+
mapMatterCategorizeId: number
|
|
1112
|
+
mapMatterId: number
|
|
1113
|
+
pic: string
|
|
1114
|
+
script: string
|
|
1115
|
+
url: string
|
|
1116
|
+
urlDesc: string
|
|
1117
|
+
urlIcon: string
|
|
1118
|
+
x: number
|
|
1119
|
+
y: number
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
interface Contribute {
|
|
1123
|
+
userHeadUrl: string
|
|
1124
|
+
userId: string
|
|
1125
|
+
userName: string
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
|
|
955
1129
|
export interface DNALoginRes {
|
|
956
1130
|
applyCancel?: number // applyCancel
|
|
957
1131
|
gender?: number // gender
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "ES2022" /* Specify what module code is generated. */,
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
"moduleResolution": "bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
"types": ["bun-types"] /* Specify type package names to be included without being referenced in a source file. */,
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
39
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
+
|
|
41
|
+
/* JavaScript Support */
|
|
42
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
43
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
44
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
45
|
+
|
|
46
|
+
/* Emit */
|
|
47
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
52
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
53
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
54
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
57
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
58
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
59
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
61
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
+
|
|
71
|
+
/* Interop Constraints */
|
|
72
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
73
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
75
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
77
|
+
|
|
78
|
+
/* Type Checking */
|
|
79
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
80
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
84
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
86
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
87
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
88
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
89
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
90
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
91
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
92
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
93
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
94
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
96
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
98
|
+
|
|
99
|
+
/* Completeness */
|
|
100
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
+
}
|
|
103
|
+
}
|