Skip to content

Commit

Permalink
add support for both pic_bed_config and picBedConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Doradx committed Sep 6, 2023
1 parent 8ef37dc commit bc9d1a2
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 19 deletions.
17 changes: 8 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149851,7 +149851,7 @@ module.exports = new BinWrapper()
.src(`${url}macos/cjpeg`, 'darwin')
.src(`${url}linux/cjpeg`, 'linux')
.src(`${url}win/cjpeg.exe`, 'win32')
.dest(__nccwpck_require__.ab + "vendor1")
.dest(__nccwpck_require__.ab + "vendor2")
.use(process.platform === 'win32' ? 'cjpeg.exe' : 'cjpeg');


Expand Down Expand Up @@ -166015,7 +166015,7 @@ module.exports = new BinWrapper()
.src(`${url}linux/x64/pngquant`, 'linux', 'x64')
.src(`${url}freebsd/x64/pngquant`, 'freebsd', 'x64')
.src(`${url}win/pngquant.exe`, 'win32')
.dest(__nccwpck_require__.ab + "vendor2")
.dest(__nccwpck_require__.ab + "vendor1")
.use(process.platform === 'win32' ? 'pngquant.exe' : 'pngquant');


Expand Down Expand Up @@ -305378,24 +305378,23 @@ function isJson(str) {
const obj = JSON.parse(str);
if (obj && typeof obj == "object") return true;
} catch (e) { }

return false;
}

var migrate_image = core.getInput("migrate_image") === "true" || false;
const picBedConfigStr = core.getInput("picBedConfig") || "{}";
const picBedConfigStr = core.getInput("pic_bed_config") || core.getInput("picBedConfig") || "{}";

// test the picBed config
if (!isJson(picBedConfigStr)) {
core.warning("picBedConfig is not a valid json string, use default config: {}, and set migrate_image to false.");
core.warning("pic_bed_config is not a valid json string, use default config: {}, and set migrate_image to false.");
migrate_image = false;
}

var picBedConfig = {};
var pic_bed_config = {};

if (migrate_image) {
core.info("migrate_image is true, use picBedConfig to upload images.");
picBedConfig = JSON.parse(picBedConfigStr);
core.info("migrate_image is true, use pic_bed_config to upload images.");
pic_bed_config = JSON.parse(picBedConfigStr);
}

var pic_base_url = core.getInput("pic_base_url") || null;
Expand All @@ -305413,7 +305412,7 @@ let config = {
notion_secret: core.getInput("notion_secret"),
database_id: core.getInput("database_id"),
migrate_image: migrate_image || false,
picBed: picBedConfig || {},
picBed: pic_bed_config || {},
pic_base_url: pic_base_url || null,
pic_compress: core.getInput("pic_compress") === "true" || false,
status: {
Expand Down
Empty file modified dist/vendor/gifsicle
100755 → 100644
Empty file.
File renamed without changes.
File renamed without changes.
Binary file added dist/vendor1/gifsicle
Binary file not shown.
Binary file added dist/vendor1/pngquant
Binary file not shown.
Binary file added dist/vendor1/source/gifsicle-1.92.tar.gz
Binary file not shown.
Binary file added dist/vendor1/source/pngquant.tar.gz
Binary file not shown.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notion2markdown-action",
"version": "0.7.3",
"version": "0.7.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
13 changes: 6 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@ function isJson(str) {
const obj = JSON.parse(str);
if (obj && typeof obj == "object") return true;
} catch (e) { }

return false;
}

var migrate_image = core.getInput("migrate_image") === "true" || false;
const picBedConfigStr = core.getInput("picBedConfig") || "{}";
const picBedConfigStr = core.getInput("pic_bed_config") || core.getInput("picBedConfig") || "{}";

// test the picBed config
if (!isJson(picBedConfigStr)) {
core.warning("picBedConfig is not a valid json string, use default config: {}, and set migrate_image to false.");
core.warning("pic_bed_config is not a valid json string, use default config: {}, and set migrate_image to false.");
migrate_image = false;
}

var picBedConfig = {};
var pic_bed_config = {};

if (migrate_image) {
core.info("migrate_image is true, use picBedConfig to upload images.");
picBedConfig = JSON.parse(picBedConfigStr);
core.info("migrate_image is true, use pic_bed_config to upload images.");
pic_bed_config = JSON.parse(picBedConfigStr);
}

var pic_base_url = core.getInput("pic_base_url") || null;
Expand All @@ -52,7 +51,7 @@ let config = {
notion_secret: core.getInput("notion_secret"),
database_id: core.getInput("database_id"),
migrate_image: migrate_image || false,
picBed: picBedConfig || {},
picBed: pic_bed_config || {},
pic_base_url: pic_base_url || null,
pic_compress: core.getInput("pic_compress") === "true" || false,
status: {
Expand Down

0 comments on commit bc9d1a2

Please sign in to comment.