diff --git a/.eslintignore b/.eslintignore index d7b2f7f..a753b6e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ -ClicksMigratingProblems/**/* \ No newline at end of file +ClicksMigratingProblems/**/* +src/reflex/nsfwjs/**/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..da4b2df --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "src/reflex/nsfwjs"] + path = src/reflex/nsfwjs + url = https://github.com/infinitered/nsfwjs + shallow = true diff --git a/package.json b/package.json index 6a9a795..c619c61 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,11 @@ "description": "Nucleus: The core of your server", "main": "dist/index.js", "scripts": { - "build": "tsc", + "build": "tsc && yarn copy-files", + "copy-files": "copyfiles -u 1 src/reflex/nsfwjs/example/nsfw_demo/public/model/**/* dist/", "start": "node --experimental-json-modules --enable-source-maps dist/index.js", - "dev": "rm -rf dist && eslint src --fix && tsc && node --experimental-json-modules --enable-source-maps dist/index.js", - "force-dev": "clear; rm -rf dist; tsc-suppress && node --experimental-json-modules --enable-source-maps dist/index.js", + "dev": "rm -rf dist && eslint src --fix && yarn build && node --experimental-json-modules --enable-source-maps dist/index.js", + "force-dev": "clear; rm -rf dist; tsc-suppress && yarn copy-files && node --experimental-json-modules --enable-source-maps dist/index.js", "lint": "echo 'Style checking...'; prettier --check .; echo 'Linting...'; eslint src; echo 'To auto-fix everything possible, please run `yarn lint-fix`'; true", "lint-no-stylecheck": "echo 'Linting...'; eslint src; echo 'A full lint and style check is required for PRs to be accepted. Please run `yarn lint` before committing'; true", "lint-fix": "echo 'Fixing eslint issues...'; eslint src --fix; echo 'Reformatting...'; prettier --write --loglevel warn --cache .; true", @@ -73,6 +74,7 @@ "@types/lodash": "^4.14.191", "@typescript-eslint/eslint-plugin": "^5.32.0", "@typescript-eslint/parser": "^5.32.0", + "copyfiles": "^2.4.1", "eslint-config-prettier": "^8.5.0", "prettier": "^2.7.1", "prettier-eslint": "^15.0.1", diff --git a/src/reflex/nsfwjs b/src/reflex/nsfwjs new file mode 160000 index 0000000..f482648 --- /dev/null +++ b/src/reflex/nsfwjs @@ -0,0 +1 @@ +Subproject commit f48264888bc1b2a805e4b20a5e5c82e11cb4754a diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts index 8b8d3c8..405e109 100644 --- a/src/reflex/scanners.ts +++ b/src/reflex/scanners.ts @@ -23,7 +23,7 @@ interface MalwareSchema { errored?: boolean; } -const nsfw_model = await nsfwjs.load(); +const nsfw_model = await nsfwjs.load("file://dist/reflex/nsfwjs/example/nsfw_demo/public/model/", { size: 299 }); const clamscanner = await new ClamScan().init({ clamdscan: { socket: config.clamavSocket diff --git a/tsconfig.json b/tsconfig.json index 8b0fe7d..1df2f7d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,5 +14,5 @@ "noImplicitReturns": false }, "include": ["src/**/*", "src/*", "src/config/main.d.ts", "src/config/main.ts"], - "exclude": ["src/Unfinished/**/*"] + "exclude": ["src/Unfinished/**/*", "src/reflex/nsfwjs/**/*"] }