safeimage changes

doesn't work on ubuntu, use docker
This commit is contained in:
2019-04-04 17:42:57 +11:00
parent 7f1e95a350
commit 7bac2d0175
3 changed files with 1067 additions and 6 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
node_modules
dbconfig.json
package-lock.json
googleapi\.json

1064
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,5 @@
const fs = require("fs")
module.exports = {
name: "Google Safe Image",
init: (dclient) => {
@@ -44,9 +46,10 @@ async function detectSafeSearch(fileName, cb) {
const vision = require('@google-cloud/vision');
// Creates a client
var pid = JSON.parse(fs.readFileSync("./googleapi.json")).project_id
const client = new vision.ImageAnnotatorClient({
projectId: 'causal-galaxy-207206',
keyFilename: 'C:/dev/myproject.json'
projectId: pid,
keyFilename: './googleapi.json'
});
/**