Commit 0b814293 authored by nanahira's avatar nanahira

bump

parent 8f3b076e
This diff is collapsed.
...@@ -28,17 +28,17 @@ ...@@ -28,17 +28,17 @@
}, },
"homepage": "https://github.com/koishijs/koishi-plugin-picsource-localfs", "homepage": "https://github.com/koishijs/koishi-plugin-picsource-localfs",
"dependencies": { "dependencies": {
"koishi-thirdeye": "^11.1.16", "koishi-thirdeye": "^11.1.20",
"read-dir-deep": "^7.0.1" "read-dir-deep": "^7.0.1"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.10.6", "koishi": "^4.11.0",
"koishi-plugin-pics": "^10.6.1" "koishi-plugin-pics": "^10.6.4"
}, },
"devDependencies": { "devDependencies": {
"@koishijs/plugin-console": "^4.7.1", "@koishijs/plugin-console": "^5.0.2",
"@koishijs/plugin-database-memory": "^2.0.1", "@koishijs/plugin-database-memory": "^2.2.0",
"@koishijs/plugin-sandbox": "^2.4.0", "@koishijs/plugin-sandbox": "^2.5.0",
"@types/jest": "^29.2.0", "@types/jest": "^29.2.0",
"@types/node": "^16.11.4", "@types/node": "^16.11.4",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^4.33.0",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"ts-jest": "^29.0.3", "ts-jest": "^29.0.3",
"ts-loader": "^9.3.1", "ts-loader": "^9.3.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.8.4", "typescript": "^4.9.4",
"webpack": "^5.74.0", "webpack": "^5.74.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",
"ws": "^8.3.0" "ws": "^8.3.0"
......
...@@ -22,11 +22,9 @@ export default class LocalSource extends PicSourcePlugin(LocalSourceConfig) { ...@@ -22,11 +22,9 @@ export default class LocalSource extends PicSourcePlugin(LocalSourceConfig) {
return null; return null;
} }
const filename = Random.pick(files); const filename = Random.pick(files);
const fileBase64 = (await fs.promises.readFile(filename)).toString( const data = await this.pics.urlToBuffer(`file://${filename}`);
'base64',
);
return { return {
url: `base64://${fileBase64}`, url: await this.pics.bufferToUrl(data.buffer, data.mime),
description: this.config.displayFilename description: this.config.displayFilename
? path.basename(filename) ? path.basename(filename)
: undefined, : undefined,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment