From 496ee02f12c7eb4e4ea33ccda49763763956a758 Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Sun, 16 Jan 2022 17:30:21 +0900 Subject: [PATCH] =?UTF-8?q?[update]=20skyway=20api=20=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E4=BF=9D=E5=AD=98=E5=A0=B4=E6=89=80=E3=81=A8=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=89=E6=96=B9=E6=B3=95=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 11 ++++++++--- index_elutil.js | 1 + package-lock.json | 32 +++++++++++++------------------- package.json | 3 +-- ugj_blocks.js | 15 ++++++++++----- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index da95253..0af8a65 100644 --- a/index.html +++ b/index.html @@ -367,7 +367,7 @@ 1 - pi.PULL_DOWN + _pi.PULL_DOWN 6 @@ -793,9 +793,14 @@ - 自分のID + 自分のID + + + + + \ No newline at end of file diff --git a/index_elutil.js b/index_elutil.js index 912445f..79baf2d 100644 --- a/index_elutil.js +++ b/index_elutil.js @@ -31,6 +31,7 @@ class elUtil { this.children = []; this.gpio_backend = ugj_const.pig; this.i2c_bus = ugj_const.i2c_defbus; + this.doc_root = process.env["HOME"] + '/Documents/'; this.doc_current = process.env["HOME"] + '/Documents'; this.executable_path = process.env["HOME"] + '/.local/lib/ocogeclub/' } diff --git a/package-lock.json b/package-lock.json index ba897a2..8754a3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@tensorflow/tfjs-converter": "^3.13.0", "@tensorflow/tfjs-core": "^3.13.0", "@tensorflow/tfjs-node": "^3.13.0", - "@vladmandic/face-api": "^1.6.3", + "@vladmandic/face-api": "^1.6.4", "axios": "^0.24.0", "electron-squirrel-startup": "^1.0.0", "nodemailer": "^6.7.2", @@ -1882,9 +1882,9 @@ } }, "node_modules/@vladmandic/face-api": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@vladmandic/face-api/-/face-api-1.6.3.tgz", - "integrity": "sha512-dB/oKHvst9Byw9umxJE4uFKpjUoVBj1AkJQUrTyHqjk2Q3AuG7mnmjVH3jJ/jKgmnAPRxwO1MBdqCptb6eyZiQ==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@vladmandic/face-api/-/face-api-1.6.4.tgz", + "integrity": "sha512-tVx8lCL1mKb44qeN5EEypJNXqxRYXh+7BcSzfY4iMaZIoF5Y+Jev20UiIn9JvxwGV2caWkdFIjpvw+OxsL/kdg==", "engines": { "node": ">=14.0.0" } @@ -10139,14 +10139,12 @@ "@tensorflow-models/knn-classifier": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@tensorflow-models/knn-classifier/-/knn-classifier-1.2.2.tgz", - "integrity": "sha512-QRnkCf7ErOxSRtvJ6yCwhlLREPcBJGaXRanF46f0iY6ii3Sybjb6Ux0qnNPTrHZChD0izPa3Z4GQEgSAykiHkQ==", - "requires": {} + "integrity": "sha512-QRnkCf7ErOxSRtvJ6yCwhlLREPcBJGaXRanF46f0iY6ii3Sybjb6Ux0qnNPTrHZChD0izPa3Z4GQEgSAykiHkQ==" }, "@tensorflow-models/mobilenet": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@tensorflow-models/mobilenet/-/mobilenet-2.1.0.tgz", - "integrity": "sha512-JjqT9ijHDFA2FEpUGWg7H2lQ0GrMuE2VmiCRBYmUew6b4JKht8LXDjG5HxZh95YH6c/25sZWTpGeHbquloH+hw==", - "requires": {} + "integrity": "sha512-JjqT9ijHDFA2FEpUGWg7H2lQ0GrMuE2VmiCRBYmUew6b4JKht8LXDjG5HxZh95YH6c/25sZWTpGeHbquloH+hw==" }, "@tensorflow/tfjs": { "version": "3.13.0", @@ -10191,8 +10189,7 @@ "@tensorflow/tfjs-converter": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-3.13.0.tgz", - "integrity": "sha512-H2VpDTv9Ve0HBt7ttzz46DmnsPaiT0B+yJjVH3NebGZbgY9C8boBgJIsdyqfiqEWBS3WxF8h4rh58Hv5XXMgaQ==", - "requires": {} + "integrity": "sha512-H2VpDTv9Ve0HBt7ttzz46DmnsPaiT0B+yJjVH3NebGZbgY9C8boBgJIsdyqfiqEWBS3WxF8h4rh58Hv5XXMgaQ==" }, "@tensorflow/tfjs-core": { "version": "3.13.0", @@ -10220,8 +10217,7 @@ "@tensorflow/tfjs-layers": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-3.13.0.tgz", - "integrity": "sha512-kTWJ/+9fbNCMDA9iQjDMYHmWivsiWz8CKNSOZdeCW7tiBwF1EiREBVQXMk1JI11ngQa8f+rYSLs7rkhp3SYl5Q==", - "requires": {} + "integrity": "sha512-kTWJ/+9fbNCMDA9iQjDMYHmWivsiWz8CKNSOZdeCW7tiBwF1EiREBVQXMk1JI11ngQa8f+rYSLs7rkhp3SYl5Q==" }, "@tensorflow/tfjs-node": { "version": "3.13.0", @@ -10367,9 +10363,9 @@ } }, "@vladmandic/face-api": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@vladmandic/face-api/-/face-api-1.6.3.tgz", - "integrity": "sha512-dB/oKHvst9Byw9umxJE4uFKpjUoVBj1AkJQUrTyHqjk2Q3AuG7mnmjVH3jJ/jKgmnAPRxwO1MBdqCptb6eyZiQ==" + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@vladmandic/face-api/-/face-api-1.6.4.tgz", + "integrity": "sha512-tVx8lCL1mKb44qeN5EEypJNXqxRYXh+7BcSzfY4iMaZIoF5Y+Jev20UiIn9JvxwGV2caWkdFIjpvw+OxsL/kdg==" }, "abbrev": { "version": "1.1.1", @@ -15233,8 +15229,7 @@ "@tensorflow/tfjs-converter": { "version": "2.8.6", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-2.8.6.tgz", - "integrity": "sha512-Uv4YC66qjVC9UwBxz0IeLZ8KS2CReh63WlGRtHcSwDEYiwsa7cvp9H6lFSSPT7kiJmrK6JtHeJGIVcTuNnSt9w==", - "requires": {} + "integrity": "sha512-Uv4YC66qjVC9UwBxz0IeLZ8KS2CReh63WlGRtHcSwDEYiwsa7cvp9H6lFSSPT7kiJmrK6JtHeJGIVcTuNnSt9w==" }, "@tensorflow/tfjs-core": { "version": "2.8.6", @@ -15260,8 +15255,7 @@ "@tensorflow/tfjs-layers": { "version": "2.8.6", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-2.8.6.tgz", - "integrity": "sha512-fdZ0i/R2dIKmy8OB5tBAsm5IbAHfJpI6AlbjxpgoU3aWj1HCdDo+pMji928MkDJhP01ISgFTgw/7PseGNaUflw==", - "requires": {} + "integrity": "sha512-fdZ0i/R2dIKmy8OB5tBAsm5IbAHfJpI6AlbjxpgoU3aWj1HCdDo+pMji928MkDJhP01ISgFTgw/7PseGNaUflw==" }, "@types/webgl2": { "version": "0.0.5", diff --git a/package.json b/package.json index 40b32bd..7fada32 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "ブロックベースビジュアルプログラム開発・実行環境", "main": "main.js", "scripts": { - "build": "npm install --legacy-peer-deps", "start": "electron-forge start", "rebuild": "electron-rebuild", "package": "electron-forge package", @@ -41,7 +40,7 @@ "@tensorflow/tfjs-converter": "^3.13.0", "@tensorflow/tfjs-core": "^3.13.0", "@tensorflow/tfjs-node": "^3.13.0", - "@vladmandic/face-api": "^1.6.3", + "@vladmandic/face-api": "^1.6.4", "axios": "^0.24.0", "electron-squirrel-startup": "^1.0.0", "nodemailer": "^6.7.2", diff --git a/ugj_blocks.js b/ugj_blocks.js index 524d9c9..6d71ac0 100644 --- a/ugj_blocks.js +++ b/ugj_blocks.js @@ -1778,7 +1778,7 @@ Blockly.JavaScript['ugj_canvas_loadimg'] = function (block) { var value_imgfilename = Blockly.JavaScript.valueToCode(block, 'imgfilename', Blockly.JavaScript.ORDER_ATOMIC); var code = [ `let _img = new Image();`, - `_img.src = '${ugj_const.doc_root}' + ${value_imgfilename};`, + `_img.src = '${elutil.doc_root}' + ${value_imgfilename};`, `_img.onload = () => _ctx.drawImage(img,0,0);`, // `ugj_canvasImg('${ugj_const.doc_root}' + ${value_imgfilename});`, '' @@ -2603,6 +2603,9 @@ Blockly.Blocks['ugj_skyway_newpeer'] = { this.appendValueInput("my_id") .setCheck("Variable") .appendField("SkyWayサーバーに ID:"); + this.appendValueInput("apikey") + .setCheck("String") + .appendField("APIキー:"); this.appendDummyInput() .appendField("で接続する"); this.appendStatementInput("do") @@ -2620,10 +2623,12 @@ Blockly.JavaScript['ugj_skyway_newpeer'] = function (block) { var value_my_id = Blockly.JavaScript.valueToCode(block, 'my_id', Blockly.JavaScript.ORDER_ATOMIC); // var variable_my_id = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('my_id'), Blockly.Variables.NAME_TYPE); // var text_name = block.getFieldValue('NAME'); + var value_apikey = Blockly.JavaScript.valueToCode(block, 'apikey', Blockly.JavaScript.ORDER_ATOMIC); var statements_do = Blockly.JavaScript.statementToCode(block, 'do'); var code = [ `const _peer = new Peer(${value_my_id}, {`, - " key: window.__SKYWAY_KEY__,", + ` key: ${value_apikey},`, + // " key: window.__SKYWAY_KEY__,", " debug: 3", "});", "_peer.on('open', () => {", @@ -2813,14 +2818,14 @@ Blockly.Blocks['ugj_file_readsync'] = { this.setOutput(true, "String"); this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND); this.setStyle('special_blocks') - this.setTooltip("あなたのホーム/ocogeディレクトリ内にあるファイルの内容を取得します。「符号化」は、テキストファイルでは通常「utf8」を選択します。"); + this.setTooltip("あなたのホーム/Documentsディレクトリ内にあるファイルの内容を取得します。「符号化」は、テキストファイルでは通常「utf8」を選択します。"); this.setHelpUrl(""); } }; Blockly.JavaScript['ugj_file_readsync'] = function (block) { var value_filename = Blockly.JavaScript.valueToCode(block, 'filename', Blockly.JavaScript.ORDER_ATOMIC); var dropdown_encoding = block.getFieldValue('encoding'); - let filepath = ugj_const.doc_root + value_filename.replace(/\'/g, ''); + let filepath = elutil.doc_root + value_filename.replace(/\'/g, ''); Blockly.JavaScript.provideFunction_( 'require_fs', [`const _fs = require('fs');`] ); @@ -3065,7 +3070,7 @@ Blockly.Blocks['ugj_child_fswebcam'] = { }; Blockly.JavaScript['ugj_child_fswebcam'] = function (block) { var value_filename = Blockly.JavaScript.valueToCode(block, 'filename', Blockly.JavaScript.ORDER_ATOMIC); - var code = `'fswebcam', ['-r', '480x360', '${ugj_const.doc_root}' + ${value_filename}]`; + var code = `'fswebcam', ['-r', '480x360', '${elutil.doc_root}' + ${value_filename}]`; return [code, Blockly.JavaScript.ORDER_NONE]; };