Skip to content

Commit

Permalink
fix!?: rename File's id2 to id and id to fileId, close #60
Browse files Browse the repository at this point in the history
  • Loading branch information
AsakuraMizu committed Jul 4, 2024
1 parent 346d5b6 commit 0641515
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
36 changes: 18 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,13 @@ export class Learn2018Helper {

return result.map((f) => {
const title = decodeHTML(f.bt);
const id = f.wjid;
const fileId = f.wjid;
const uploadTime = new Date(f.scsj);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(id, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, id, courseType, this.previewFirstPage);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(fileId, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, fileId, courseType, this.previewFirstPage);
return {
id,
id2: f.kjxxid,
id: f.kjxxid,
fileId,
category: categories.get(f.kjflid),
title,
description: decodeHTML(f.ms),
Expand All @@ -464,7 +464,7 @@ export class Learn2018Helper {
downloadCount: f.xzcs ?? 0,
fileType: f.wjlx,
remoteFile: {
id,
id: fileId,
name: title,
downloadUrl,
previewUrl,
Expand Down Expand Up @@ -522,15 +522,15 @@ export class Learn2018Helper {
const result = (json.object ?? []) as any[];

return result.map((f) => {
const id = f[7];
const fileId = f[7];
const title = decodeHTML(f[1]);
const rawSize = f[9];
const size = formatFileSize(rawSize);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(id, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, id, courseType, this.previewFirstPage);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(fileId, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, fileId, courseType, this.previewFirstPage);
return {
id,
id2: f[0],
id: f[0],
fileId,
title,
description: decodeHTML(f[5]),
rawSize,
Expand All @@ -545,7 +545,7 @@ export class Learn2018Helper {
downloadCount: 0,
fileType: f[13],
remoteFile: {
id,
id: fileId,
name: title,
downloadUrl,
previewUrl,
Expand All @@ -571,13 +571,13 @@ export class Learn2018Helper {

return result.map((f) => {
const title = decodeHTML(f.bt);
const id = f.wjid;
const fileId = f.wjid;
const uploadTime = new Date(f.scsj);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(id, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, id, courseType, this.previewFirstPage);
const downloadUrl = URLS.LEARN_FILE_DOWNLOAD(fileId, courseType);
const previewUrl = URLS.LEARN_FILE_PREVIEW(ContentType.FILE, fileId, courseType, this.previewFirstPage);
return {
id,
id2: f.kjxxid,
id: f.kjxxid,
fileId,
title,
description: decodeHTML(f.ms),
rawSize: f.wjdx,
Expand All @@ -592,7 +592,7 @@ export class Learn2018Helper {
downloadCount: f.xzcs ?? 0,
fileType: f.wjlx,
remoteFile: {
id,
id: fileId,
name: title,
downloadUrl,
previewUrl,
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ interface IFileCategory {
export type FileCategory = IFileCategory;

interface IFile {
/** previously `id2` */
id: string;
id2: string;
/** previously `id` */
fileId: string;
/** note: will be unset when calling `getFileListByCategory` */
category?: FileCategory;
/** size in byte */
Expand Down

0 comments on commit 0641515

Please sign in to comment.