TheDesk Mio (ver.4) mac modify

This commit is contained in:
a a 2018-05-26 04:00:04 +09:00
parent d4de0a6ca8
commit d5f7153464
9 changed files with 76 additions and 31 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -26,7 +26,7 @@
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script> <script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
<script> <script>
//必ずアプデ時のremove instance消して //必ずアプデ時のremove instance消して
var ver="Mio (ver.3)"; var ver="Mio (ver.4)";
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//var ver="beta"; //var ver="beta";
var acct_id=0; var acct_id=0;
@ -682,6 +682,7 @@ var tlid=0;
<h5>Release Note</h5> <h5>Release Note</h5>
・nodist セキュリティアップデート<br> ・nodist セキュリティアップデート<br>
・UI変更<br> ・UI変更<br>
・macOSで通知が表示されるように<br>
以下はver.3の新機能<br> 以下はver.3の新機能<br>
・macOS版正式リリース<br> ・macOS版正式リリース<br>
・Spotifyなうぷれ改修(アートワーク投稿)<br> ・Spotifyなうぷれ改修(アートワーク投稿)<br>

View File

@ -34,7 +34,17 @@ function notf(acct_id, tlid, sys) {
} }
var electron = require("electron"); var electron = require("electron");
var ipc = electron.ipcRenderer; var ipc = electron.ipcRenderer;
ipc.send('native-notf', ['TheDesk:'+domain,ct+"件の新しい通知",localStorage.getItem("prof_"+acct_id)]); var os = electron.remote.process.platform;
var options = {
body: ct+"件の新しい通知",
icon: tlocalStorage.getItem("prof_"+acct_id)
};
if(os=="darwin"){
var n = new Notification('TheDesk:'+domain, options);
}else{
ipc.send('native-notf', ['TheDesk:'+domain,ct+"件の新しい通知",localStorage.getItem("prof_"+acct_id)]);
}
} }
if(obj.type!="follow"){ if(obj.type!="follow"){
templete = templete+parse([obj], 'notf', acct_id, 'notf', -1); templete = templete+parse([obj], 'notf', acct_id, 'notf', -1);

View File

@ -174,20 +174,22 @@ function parse(obj, mix, acct_id, tlid, popup) {
if (popup >= 0 && obj.length < 5 && noticetext != memory) { if (popup >= 0 && obj.length < 5 && noticetext != memory) {
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if(popup>0){ if(popup>0){
if(native=="yes"){
var electron = require("electron");
var ipc = electron.ipcRenderer;
var options = {
body: toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),
icon: toot.account.avatar
};
var n = new Notification('TheDesk:'+domain, options);
console.log(n);
//ipc.send('native-notf', ['TheDesk:'+domain,toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),toot.account.avatar]);
}
Materialize.toast("["+domain+"より]"+escapeHTML(toot.account.display_name)+what, popup * 1000); Materialize.toast("["+domain+"より]"+escapeHTML(toot.account.display_name)+what, popup * 1000);
} }
if(native=="yes"){
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var options = {
body: toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),
icon: toot.account.avatar
};
if(os=="darwin"){
var n = new Notification('TheDesk:'+domain, options);
}else{
ipc.send('native-notf', ['TheDesk:'+domain,toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),toot.account.avatar]);
}
}
$(".notf-icon_" + acct_id).addClass("red-text"); $(".notf-icon_" + acct_id).addClass("red-text");
localStorage.setItem("notice-mem", noticetext); localStorage.setItem("notice-mem", noticetext);
noticetext = ""; noticetext = "";

View File

@ -349,4 +349,19 @@ function wordempSave(){
var word=$('#wordemp').material_chip('data'); var word=$('#wordemp').material_chip('data');
var json = JSON.stringify(word); var json = JSON.stringify(word);
localStorage.setItem("word_emp", json); localStorage.setItem("word_emp", json);
}
function notftest(){
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var options = {
body: '通知テスト(画像はあなたのアカウントのアイコンです)',
icon: localStorage.getItem("prof_0")
};
if(os=="darwin"){
var n = new Notification('TheDesk通知テスト', options);
}else{
ipc.send('native-notf', ['TheDesk通知テスト','通知テスト(画像はあなたのアカウントのアイコンです)',localStorage.getItem('prof_0')]);
}
} }

View File

@ -20,8 +20,6 @@ const app = electron.app;
withFallback: false, // Fallback to Growl or Balloons? withFallback: false, // Fallback to Growl or Balloons?
customPath: void 0 // Relative path if you want to use your fork of toast.exe customPath: void 0 // Relative path if you want to use your fork of toast.exe
}); });
}else if(platform=="darwin"){
Notification = require('node-mac-notifier');
} }
// ウィンドウを作成するモジュール // ウィンドウを作成するモジュール
@ -138,18 +136,7 @@ ipc.on('native-notf', function(e, args) {
}); });
}); });
}else if(platform=="darwin"){ }
Jimp.read(args[2], function (err, lenna) {
if(!err && lenna){
lenna.write(tmp_img);
var tmp_imge=tmp_img;
}else{
var tmp_imge="";
}
noti = new Notification(args[0], {body: args[0],icon: tmp_imge});
});
}
}); });
ipc.on('update', function(e, x, y) { ipc.on('update', function(e, x, y) {

31
app/package-lock.json generated
View File

@ -54,6 +54,12 @@
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.4.0.tgz", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.4.0.tgz",
"integrity": "sha1-g4qZLan51zfg9LLbC+YrsJ3Qxeg=" "integrity": "sha1-g4qZLan51zfg9LLbC+YrsJ3Qxeg="
}, },
"bindings": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
"integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==",
"optional": true
},
"bmp-js": { "bmp-js": {
"version": "0.0.3", "version": "0.0.3",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.0.3.tgz", "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.0.3.tgz",
@ -155,6 +161,12 @@
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
"integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=" "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM="
}, },
"event-target-shim": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-1.1.1.tgz",
"integrity": "sha1-qG5e5r2qFgVEddp5fM3fDFVphJE=",
"optional": true
},
"exif-parser": { "exif-parser": {
"version": "0.1.12", "version": "0.1.12",
"resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz",
@ -448,6 +460,25 @@
"resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz", "resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz",
"integrity": "sha1-mi3sg4Bvuy2XXyK+7IWcoms5OqE=" "integrity": "sha1-mi3sg4Bvuy2XXyK+7IWcoms5OqE="
}, },
"node-mac-notifier": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/node-mac-notifier/-/node-mac-notifier-0.1.0.tgz",
"integrity": "sha512-K07p0jW6BhE4Jxpem4pcOdOCDgF/vy3xIqZoZpqme5JAfeW0cEkQ5Z3AmsM7fhJB59kDeOiouyykwPnvLV+hAg==",
"optional": true,
"requires": {
"bindings": "1.3.0",
"event-target-shim": "1.1.1",
"node-uuid": "1.4.8"
},
"dependencies": {
"node-uuid": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz",
"integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=",
"optional": true
}
}
},
"node-notifier": { "node-notifier": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz", "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz",

View File

@ -15,7 +15,6 @@
"node-notifier": "^5.2.1" "node-notifier": "^5.2.1"
}, },
"optionalDependencies": { "optionalDependencies": {
"itunes-nowplaying-mac": "^0.2.3", "itunes-nowplaying-mac": "^0.2.3"
"node-mac-notifier":"0.1.0"
} }
} }

View File

@ -35,7 +35,7 @@
<input type="text" style="width:50px" id="popup"> <input type="text" style="width:50px" id="popup">
<button class="btn waves-effect" style="width:100px;" onclick="settings()">設定</button> <button class="btn waves-effect" style="width:100px;" onclick="settings()">設定</button>
<br> <br>
<h5>ネイティブ通知設定</h5><a onclick="require('electron').ipcRenderer.send('native-notf', ['TheDesk通知テスト','通知テスト(画像はあなたのアカウントのアイコンです)',localStorage.getItem('prof_0')]);" class="pointer">通知テスト</a> <h5>ネイティブ通知設定</h5><a onclick="notftest()" class="pointer">通知テスト</a>
<br> <br>
<input class="with-gap" onchange="settings()" name="notf" type="radio" id="ntf_yes" value="yes" /> <input class="with-gap" onchange="settings()" name="notf" type="radio" id="ntf_yes" value="yes" />
<label for="ntf_yes">はい</label> <label for="ntf_yes">はい</label>