Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js v22 対応 #1057

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ All notable changes to this project will be documented in this file.
## [2025]

### Added

- Deep Linking support from Blackboard (OU)

## [2024]

### Added

- Version management feature (NII)
- Tag/note registration (OU)
- Word cloud (OU)
Expand All @@ -19,6 +21,7 @@ All notable changes to this project will be documented in this file.
## [2023]

### Added

- Video thumbnail display
- Viewing status timeline (OU)
- Names and Role Provisioning Services support (OU)
Expand All @@ -28,12 +31,14 @@ All notable changes to this project will be documented in this file.
- Deep Linking support

### Changed

- Removal of IP address-based client authentication
- Video interaction log improvement (NII)

## [2022]

### Added

- Keyword registration (NII)
- Multiple author registration (NII)
- License registration (NII)
Expand All @@ -50,6 +55,7 @@ All notable changes to this project will be documented in this file.
## [2021]

### Added

- LTI 1.1 authentication from Blackboard (OU)
- Viewing history (OU)
- Learning analytics (OU)
Expand All @@ -68,6 +74,7 @@ All notable changes to this project will be documented in this file.
## [2020]

### Added

- RDB support (NII)
- LTI 1.1 authentication from Moodle (NII)
- Role-based access control (NII)
Expand All @@ -76,14 +83,18 @@ All notable changes to this project will be documented in this file.
- Video interaction log output (NII)

### Changed

- Complete migration from PHP to TypeScript

## Development

- The initial development of this project was carried out by NII.

## Note

- Contribution attributions vary due to differences in documentation practices.

## Organization Abbreviations

- NII: National Institute of Informatics
- OU: Osaka University
- OU: Osaka University
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Contributors listed below have made various contributions to different aspects o
- National Institute of Informatics (2020 - )
- NPO Consortium TIES (2020 - )
- Osaka University (2021 - )
- Kumamoto University (2021 - )
- Kumamoto University (2021 - )
2 changes: 1 addition & 1 deletion README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ MIT

## funding

永続的な開発を続けるために、寄付を歓迎します。
永続的な開発を続けるために、寄付を歓迎します。
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![ロゴ](docs/assets/chibichilo_s.png)CHiBi-CHiLO
# ![ロゴ](docs/assets/chibichilo_s.png)CHiBi-CHiLO

[English](README-en.md) | [日本語](README-ja.md)

Expand All @@ -9,9 +9,11 @@ LMS と外部接続する[LTI ツールプロバイダー](https://www.imsglobal
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fnpocccties%2Fchibichilo&env=SESSION_SECRET,DATABASE_URL)

## License

This project is released under the MIT License. The full text can be found in the [LICENSE file](LICENSE).

## Contributors

We appreciate contributions to this project. A list of all contributors can be found in the [CONTRIBUTORS file](CONTRIBUTORS.md).

These documents serve to ensure transparency and equality among all participants in the project, accurately reflecting each member's involvement and the collective nature of the project.
These documents serve to ensure transparency and equality among all participants in the project, accurately reflecting each member's involvement and the collective nature of the project.
135 changes: 69 additions & 66 deletions server/utils/book/importBooksUtil.ts
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

差分はformatの改行のみです。

Original file line number Diff line number Diff line change
Expand Up @@ -517,78 +517,81 @@ class ImportBooksUtil {
return;
}
zipfile.readEntry();
zipfile.on("entry", (entry) => {
// ディレクトリは fileName が '/' で終わっている
if (/\/$/.test(entry.fileName)) {
zipfile.readEntry();
} else {
const filename = path.join(this.tmpdir, entry.fileName);
const dirname = path.dirname(filename);
zipfile.openReadStream(entry, (err, readStream) => {
if (err) {
this.errors.push(`openReadStreamでエラーが発生しました。\n${err}`);
zipfile.readEntry();
return;
}
try {
if (!fs.existsSync(dirname)) {
fs.mkdirSync(dirname, { recursive: true });
}
readStream.on("end", () => {
zipfile.readEntry();
});
const ws = fs.createWriteStream(filename);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readStream.pipe(ws).on("error", (err: any) => {
zipfile
.on("entry", (entry) => {
// ディレクトリは fileName が '/' で終わっている
if (/\/$/.test(entry.fileName)) {
zipfile.readEntry();
} else {
const filename = path.join(this.tmpdir, entry.fileName);
const dirname = path.dirname(filename);
zipfile.openReadStream(entry, (err, readStream) => {
if (err) {
this.errors.push(
`zip解凍中にファイルの書き込みに失敗しました。\n${err}`
`openReadStreamでエラーが発生しました。\n${err}`
);
zipfile.readEntry();
return;
}
try {
if (!fs.existsSync(dirname)) {
fs.mkdirSync(dirname, { recursive: true });
}
readStream.on("end", () => {
zipfile.readEntry();
});
const ws = fs.createWriteStream(filename);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readStream.pipe(ws).on("error", (err: any) => {
this.errors.push(
`zip解凍中にファイルの書き込みに失敗しました。\n${err}`
);
readStream.destroy();
zipfile.readEntry();
});
} catch (err) {
this.errors.push(`zip解凍中に例外が発生しました。\n${err}`);
readStream.destroy();
zipfile.readEntry();
});
} catch (err) {
this.errors.push(`zip解凍中に例外が発生しました。\n${err}`);
readStream.destroy();
zipfile.readEntry();
}
});
}
})
.on("close", () => {
this.unzippedFiles = recursive(this.tmpdir);
const jsonfiles: string[] = this.unzippedFiles.filter((filename) =>
filename.toLowerCase().endsWith(".json")
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const jsons: any[] = [];
if (jsonfiles.length) {
for (const jsonfile of jsonfiles) {
try {
const json = JSON.parse(fs.readFileSync(jsonfile).toString());
jsons.push(...(Array.isArray(json) ? json : [json]));
} catch (e) {
this.errors.push(
`入力されたjsonテキストを解釈できません。\n${e}`
);
}
});
}
})
.on("close", () => {
this.unzippedFiles = recursive(this.tmpdir);
const jsonfiles: string[] = this.unzippedFiles.filter((filename) =>
filename.toLowerCase().endsWith(".json")
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const jsons: any[] = [];
if (jsonfiles.length) {
for (const jsonfile of jsonfiles) {
try {
const json = JSON.parse(fs.readFileSync(jsonfile).toString());
jsons.push(...(Array.isArray(json) ? json : [json]));
} catch (e) {
this.errors.push(
`入力されたjsonテキストを解釈できません。\n${e}`
);
}
}
} else {
this.errors.push("jsonファイルがありません。");
}
} else {
this.errors.push("jsonファイルがありません。");
}
if (this.errors.length) {
resolve({});
} else {
resolve(jsons);
}
})
.on("error", (error) => {
try {
resolve(JSON.parse(fs.readFileSync(file).toString()));
} catch (e) {
this.errors.push(`ファイルがzipではありません。\n${error}`);
resolve({});
}
});
if (this.errors.length) {
resolve({});
} else {
resolve(jsons);
}
})
.on("error", (error) => {
try {
resolve(JSON.parse(fs.readFileSync(file).toString()));
} catch (e) {
this.errors.push(`ファイルがzipではありません。\n${error}`);
resolve({});
}
});
});
});
}
Expand Down