Change: markers API trigger
This commit is contained in:
parent
8c29f21970
commit
f2ec258e7a
@ -107,6 +107,8 @@ var lang={
|
|||||||
"lang_tags_tagwarn": "Автоматично попълване на {{tag}}, ако раздумката няма {{tag}}",
|
"lang_tags_tagwarn": "Автоматично попълване на {{tag}}, ако раздумката няма {{tag}}",
|
||||||
"lang_tl_media": "Media",
|
"lang_tl_media": "Media",
|
||||||
"lang_tl_reconnect": "Reconnect to streaming API",
|
"lang_tl_reconnect": "Reconnect to streaming API",
|
||||||
|
"lang_tl_postmarkers_title": "Process...",
|
||||||
|
"lang_tl_postmarkers": "POST markers data. Please wait",
|
||||||
"lang_img_DLDone": "Downloaded:",
|
"lang_img_DLDone": "Downloaded:",
|
||||||
"lang_layout_gotop": "Go top of this column. When icon is red, this column cannot connect straming API. Please reload.",
|
"lang_layout_gotop": "Go top of this column. When icon is red, this column cannot connect straming API. Please reload.",
|
||||||
"lang_layout_thisacct": "{{notf}} of this account",
|
"lang_layout_thisacct": "{{notf}} of this account",
|
||||||
|
@ -107,6 +107,8 @@ var lang={
|
|||||||
"lang_tags_tagwarn": "Auto complete {{tag}}, if toot without {{tag}}",
|
"lang_tags_tagwarn": "Auto complete {{tag}}, if toot without {{tag}}",
|
||||||
"lang_tl_media": "Média",
|
"lang_tl_media": "Média",
|
||||||
"lang_tl_reconnect": "Reconnect to streaming API",
|
"lang_tl_reconnect": "Reconnect to streaming API",
|
||||||
|
"lang_tl_postmarkers_title": "Process...",
|
||||||
|
"lang_tl_postmarkers": "POST markers data. Please wait",
|
||||||
"lang_img_DLDone": "Downloaded:",
|
"lang_img_DLDone": "Downloaded:",
|
||||||
"lang_layout_gotop": "Go top of this column. When icon is red, this column cannot connect straming API. Please reload.",
|
"lang_layout_gotop": "Go top of this column. When icon is red, this column cannot connect straming API. Please reload.",
|
||||||
"lang_layout_thisacct": "{{notf}} tohoto účtu",
|
"lang_layout_thisacct": "{{notf}} tohoto účtu",
|
||||||
|
@ -107,6 +107,8 @@ var lang={
|
|||||||
"lang_tags_tagwarn": "Automatisch {{tag}} anfügen, wenn Tröt ohne {{tag}} ist",
|
"lang_tags_tagwarn": "Automatisch {{tag}} anfügen, wenn Tröt ohne {{tag}} ist",
|
||||||
"lang_tl_media": "Medien",
|
"lang_tl_media": "Medien",
|
||||||
"lang_tl_reconnect": "Mit Streaming API erneut verbinden",
|
"lang_tl_reconnect": "Mit Streaming API erneut verbinden",
|
||||||
|
"lang_tl_postmarkers_title": "Process...",
|
||||||
|
"lang_tl_postmarkers": "POST markers data. Please wait",
|
||||||
"lang_img_DLDone": "Heruntergeladen:",
|
"lang_img_DLDone": "Heruntergeladen:",
|
||||||
"lang_layout_gotop": "Gehen Sie zum Anfang dieser Spalte. Wenn das Symbol rot ist, kann diese Spalte keine Verbindung zur Streaming-API herstellen. Bitte neu laden.",
|
"lang_layout_gotop": "Gehen Sie zum Anfang dieser Spalte. Wenn das Symbol rot ist, kann diese Spalte keine Verbindung zur Streaming-API herstellen. Bitte neu laden.",
|
||||||
"lang_layout_thisacct": "{{notf}} dieses Kontos",
|
"lang_layout_thisacct": "{{notf}} dieses Kontos",
|
||||||
|
@ -131,6 +131,8 @@ var lang = {
|
|||||||
//tl/tl.js
|
//tl/tl.js
|
||||||
"lang_tl_media": "Media",
|
"lang_tl_media": "Media",
|
||||||
"lang_tl_reconnect": "Reconnect to streaming API",
|
"lang_tl_reconnect": "Reconnect to streaming API",
|
||||||
|
"lang_tl_postmarkers_title": "Process...",
|
||||||
|
"lang_tl_postmarkers": "POST markers data. Please wait",
|
||||||
//ui/img.js
|
//ui/img.js
|
||||||
"lang_img_DLDone": "Downloaded:",
|
"lang_img_DLDone": "Downloaded:",
|
||||||
//ui/layout.js
|
//ui/layout.js
|
||||||
|
@ -131,6 +131,8 @@ var lang = {
|
|||||||
//tl/tl.js
|
//tl/tl.js
|
||||||
"lang_tl_media": "メディア",
|
"lang_tl_media": "メディア",
|
||||||
"lang_tl_reconnect": "Streamingに再接続しました",
|
"lang_tl_reconnect": "Streamingに再接続しました",
|
||||||
|
"lang_tl_postmarkers_title": "処理中",
|
||||||
|
"lang_tl_postmarkers": "未読マーカーを送信しています。3秒以内に閉じられます。",
|
||||||
//ui/img.js
|
//ui/img.js
|
||||||
"lang_img_DLDone": "ダウンロード先:",
|
"lang_img_DLDone": "ダウンロード先:",
|
||||||
//ui/layout.js
|
//ui/layout.js
|
||||||
|
@ -183,6 +183,10 @@ onmessage = function (e) {
|
|||||||
updateMess(e.data[1]);
|
updateMess(e.data[1]);
|
||||||
} else if (e.data[0] == "renderAbout") {
|
} else if (e.data[0] == "renderAbout") {
|
||||||
renderAbout(e.data[1]);
|
renderAbout(e.data[1]);
|
||||||
|
} else if (e.data[0] == "asRead") {
|
||||||
|
asRead()
|
||||||
|
} else if (e.data[0] == "asReadEnd") {
|
||||||
|
asReadEnd()
|
||||||
} else if (e.data[0] == "alert") {
|
} else if (e.data[0] == "alert") {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -57,6 +57,8 @@ onmessage = function (e) {
|
|||||||
ipc.send('download-btn', e.data[1]);
|
ipc.send('download-btn', e.data[1]);
|
||||||
} else if (e.data[0] == "nano") {
|
} else if (e.data[0] == "nano") {
|
||||||
ipc.send('nano', null);
|
ipc.send('nano', null);
|
||||||
|
} else if (e.data[0] == "asReadComp") {
|
||||||
|
ipc.send('sendMarkersComplete', null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//version.js
|
//version.js
|
||||||
@ -164,6 +166,12 @@ ipc.on('prog', function (event, arg) {
|
|||||||
ipc.on('mess', function (event, arg) {
|
ipc.on('mess', function (event, arg) {
|
||||||
postMessage(["updateMess", arg], "*")
|
postMessage(["updateMess", arg], "*")
|
||||||
})
|
})
|
||||||
|
ipc.on('asRead', function (event, arg) {
|
||||||
|
postMessage(["asRead", ""], "*")
|
||||||
|
})
|
||||||
|
ipc.on('asReadEnd', function (event, arg) {
|
||||||
|
postMessage(["asReadEnd", ""], "*")
|
||||||
|
})
|
||||||
var webviewDom = document.getElementById('webview');
|
var webviewDom = document.getElementById('webview');
|
||||||
if (webviewDom) {
|
if (webviewDom) {
|
||||||
webviewDom.addEventListener('new-window', function (e) {
|
webviewDom.addEventListener('new-window', function (e) {
|
||||||
|
@ -999,24 +999,24 @@ function ueload(tlid) {
|
|||||||
columnReload(tlid, type)
|
columnReload(tlid, type)
|
||||||
}
|
}
|
||||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
|
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type)
|
||||||
} else {
|
} else {
|
||||||
var mute = [];
|
var mute = []
|
||||||
}
|
}
|
||||||
var templete = parse(json, '', acct_id, tlid, "", mute, type);
|
var templete = parse(json, '', acct_id, tlid, "", mute, type)
|
||||||
var len = json.length - 1
|
var len = json.length - 1
|
||||||
$("#timeline_" + tlid).prepend(templete);
|
$("#timeline_" + tlid).prepend(templete)
|
||||||
if ($("#timeline_" + tlid + " .cvo:eq(" + len + ")").length) {
|
if ($("#timeline_" + tlid + " .cvo:eq(" + len + ")").length) {
|
||||||
var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top
|
var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top
|
||||||
$("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to)
|
$("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to)
|
||||||
}
|
}
|
||||||
additional(acct_id, tlid);
|
additional(acct_id, tlid)
|
||||||
jQuery("time.timeago").timeago();
|
jQuery("time.timeago").timeago()
|
||||||
todc();
|
todc()
|
||||||
ueloadlock = false
|
ueloadlock = false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function asRead() {
|
function asRead(callback) {
|
||||||
//Markers
|
//Markers
|
||||||
var markers = localStorage.getItem("markers");
|
var markers = localStorage.getItem("markers");
|
||||||
if (markers == "no") {
|
if (markers == "no") {
|
||||||
@ -1027,7 +1027,9 @@ function asRead() {
|
|||||||
if (markers) {
|
if (markers) {
|
||||||
var multi = localStorage.getItem("column")
|
var multi = localStorage.getItem("column")
|
||||||
var obj = JSON.parse(multi)
|
var obj = JSON.parse(multi)
|
||||||
for (var i = 0; i < obj.length; i++) {
|
var obl = obj.length
|
||||||
|
ct = 0
|
||||||
|
for (var i = 0; i < obl; i++) {
|
||||||
var acct_id = obj[i].domain
|
var acct_id = obj[i].domain
|
||||||
var type = obj[i].type
|
var type = obj[i].type
|
||||||
if (type == "home" || type == "notf") {
|
if (type == "home" || type == "notf") {
|
||||||
@ -1046,23 +1048,53 @@ function asRead() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var domain = localStorage.getItem("domain_" + acct_id);
|
|
||||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
var domain = localStorage.getItem("domain_" + acct_id)
|
||||||
var httpreq = new XMLHttpRequest();
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
||||||
|
var httpreq = new XMLHttpRequest()
|
||||||
var start = "https://" + domain + "/api/v1/markers"
|
var start = "https://" + domain + "/api/v1/markers"
|
||||||
httpreq.open('POST', start, true);
|
httpreq.open('POST', start, true)
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = "json";
|
httpreq.responseType = "json"
|
||||||
httpreq.send(JSON.stringify(poster));
|
httpreq.send(JSON.stringify(poster))
|
||||||
httpreq.onreadystatechange = function () {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response;
|
var json = httpreq.response
|
||||||
console.log(json)
|
console.log(json)
|
||||||
|
ct++
|
||||||
|
if (ct == obl && callback) {
|
||||||
|
postMessage(["asReadComp", ""], "*")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cbTimer1 = setInterval(asRead, 60000);
|
function asReadEnd() {
|
||||||
|
//Markers
|
||||||
|
var markers = localStorage.getItem("markers");
|
||||||
|
if (markers == "no") {
|
||||||
|
markers = false;
|
||||||
|
} else {
|
||||||
|
markers = true
|
||||||
|
}
|
||||||
|
if (markers) {
|
||||||
|
asRead(true)
|
||||||
|
Swal.fire({
|
||||||
|
title: lang.lang_tl_postmarkers_title,
|
||||||
|
html: lang.lang_tl_postmarkers,
|
||||||
|
timer: 3000,
|
||||||
|
onBeforeOpen: () => {
|
||||||
|
Swal.showLoading()
|
||||||
|
},
|
||||||
|
onClose: () => {
|
||||||
|
}
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
postMessage(["asReadComp", ""], "*")
|
||||||
|
}
|
||||||
|
}
|
91
app/main.js
91
app/main.js
@ -12,6 +12,7 @@ const np = require('./main/np.js');
|
|||||||
const systemFunc = require('./main/system.js');
|
const systemFunc = require('./main/system.js');
|
||||||
const Menu = electron.Menu
|
const Menu = electron.Menu
|
||||||
const join = require('path').join;
|
const join = require('path').join;
|
||||||
|
|
||||||
// アプリケーションをコントロールするモジュール
|
// アプリケーションをコントロールするモジュール
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
// ウィンドウを作成するモジュール
|
// ウィンドウを作成するモジュール
|
||||||
@ -29,8 +30,8 @@ if (!gotTheLock) {
|
|||||||
// 多重起動を試みた場合、既に存在するウィンドウにフォーカスを移す
|
// 多重起動を試みた場合、既に存在するウィンドウにフォーカスを移す
|
||||||
// Someone tried to run a second instance, we should focus our window.
|
// Someone tried to run a second instance, we should focus our window.
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
if (mainWindow.isMinimized()) mainWindow.restore()
|
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||||
mainWindow.focus()
|
mainWindow.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -40,18 +41,18 @@ if (process.argv.indexOf("--dev") === -1) {
|
|||||||
} else {
|
} else {
|
||||||
var packaged = false;
|
var packaged = false;
|
||||||
console.log(
|
console.log(
|
||||||
"||\\\\\\ \n"+
|
"||\\\\\\ \n" +
|
||||||
"|||| \\\\\\\\ \n"+
|
"|||| \\\\\\\\ \n" +
|
||||||
"|||| \\\\\\\\ \n"+
|
"|||| \\\\\\\\ \n" +
|
||||||
"|||| Am I a \\\\\\\\ \n"+
|
"|||| Am I a \\\\\\\\ \n" +
|
||||||
"|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n"+
|
"|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n" +
|
||||||
"|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n"+
|
"|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n" +
|
||||||
"|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n"+
|
"|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n" +
|
||||||
"|||| < _ _) ////// | | | | | | __/ |_| | __/\__ \\ < \n"+
|
"|||| < _ _) ////// | | | | | | __/ |_| | __/\__ \\ < \n" +
|
||||||
"|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n"+
|
"|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n" +
|
||||||
"|||| ///// \n"+
|
"|||| ///// \n" +
|
||||||
"|||| /////\n"+
|
"|||| /////\n" +
|
||||||
"|||| /////\n"+
|
"|||| /////\n" +
|
||||||
"||||//////"
|
"||||//////"
|
||||||
)
|
)
|
||||||
console.log("Welcome!")
|
console.log("Welcome!")
|
||||||
@ -63,9 +64,9 @@ var ha_path = join(app.getPath("userData"), "hardwareAcceleration");
|
|||||||
try {
|
try {
|
||||||
fs.readFileSync(ha_path, 'utf8');
|
fs.readFileSync(ha_path, 'utf8');
|
||||||
app.disableHardwareAcceleration()
|
app.disableHardwareAcceleration()
|
||||||
if(!packaged) console.log("disabled: Hardware Acceleration");
|
if (!packaged) console.log("disabled: Hardware Acceleration");
|
||||||
} catch{
|
} catch{
|
||||||
if(!packaged) console.log("enabled: Hardware Acceleration");
|
if (!packaged) console.log("enabled: Hardware Acceleration");
|
||||||
}
|
}
|
||||||
var window_size;
|
var window_size;
|
||||||
try {
|
try {
|
||||||
@ -131,8 +132,8 @@ function createWindow() {
|
|||||||
fs.writeFileSync(lang_path, lang);
|
fs.writeFileSync(lang_path, lang);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(!packaged) console.log("your lang:" + app.getLocale());
|
if (!packaged) console.log("your lang:" + app.getLocale());
|
||||||
if(!packaged) console.log("launch:" + lang);
|
if (!packaged) console.log("launch:" + lang);
|
||||||
// メイン画面の表示。ウィンドウの幅、高さを指定できる
|
// メイン画面の表示。ウィンドウの幅、高さを指定できる
|
||||||
var platform = process.platform;
|
var platform = process.platform;
|
||||||
var bit = process.arch;
|
var bit = process.arch;
|
||||||
@ -173,7 +174,7 @@ function createWindow() {
|
|||||||
if (window_size.max) {
|
if (window_size.max) {
|
||||||
mainWindow.maximize();
|
mainWindow.maximize();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
electron.session.defaultSession.clearCache(() => { })
|
electron.session.defaultSession.clearCache(() => { })
|
||||||
if (process.argv) {
|
if (process.argv) {
|
||||||
if (process.argv[1]) {
|
if (process.argv[1]) {
|
||||||
@ -200,7 +201,27 @@ function createWindow() {
|
|||||||
electron.ipcMain.removeAllListeners();
|
electron.ipcMain.removeAllListeners();
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
mainWindow.on('close', function () {
|
closeArg = false
|
||||||
|
mainWindow.on('close', function (e, arg) {
|
||||||
|
if(!closeArg){
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
const promise = new Promise(function (resolve) {
|
||||||
|
mainWindow.webContents.send('asReadEnd', "")
|
||||||
|
setTimeout(function () { resolve() }, 3000)
|
||||||
|
})
|
||||||
|
promise.then((function (response) {
|
||||||
|
writePos(mainWindow)
|
||||||
|
closeArg = true
|
||||||
|
mainWindow.close()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
electron.ipcMain.on('sendMarkersComplete', function (e, arg) {
|
||||||
|
closeArg = true
|
||||||
|
mainWindow.close()
|
||||||
|
})
|
||||||
|
function writePos(mainWindow){
|
||||||
if (
|
if (
|
||||||
max_window_size.width == mainWindow.getBounds().width &&
|
max_window_size.width == mainWindow.getBounds().width &&
|
||||||
max_window_size.height == mainWindow.getBounds().height &&
|
max_window_size.height == mainWindow.getBounds().height &&
|
||||||
@ -211,11 +232,14 @@ function createWindow() {
|
|||||||
} else {
|
} else {
|
||||||
var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y }
|
var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y }
|
||||||
}
|
}
|
||||||
fs.writeFileSync(info_path, JSON.stringify(size));
|
fs.writeFileSync(info_path, JSON.stringify(size))
|
||||||
});
|
}
|
||||||
mainWindow.on('maximize', function () {
|
mainWindow.on('maximize', function () {
|
||||||
fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds()));
|
fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds()));
|
||||||
});
|
});
|
||||||
|
mainWindow.on('minimize', function () {
|
||||||
|
mainWindow.webContents.send('asRead', "")
|
||||||
|
})
|
||||||
|
|
||||||
var platform = process.platform;
|
var platform = process.platform;
|
||||||
var bit = process.arch;
|
var bit = process.arch;
|
||||||
@ -230,6 +254,29 @@ function createWindow() {
|
|||||||
np.TheDeskNowPlaying(mainWindow);
|
np.TheDeskNowPlaying(mainWindow);
|
||||||
//その他system
|
//その他system
|
||||||
systemFunc.system(mainWindow, dir, lang, dirname);
|
systemFunc.system(mainWindow, dir, lang, dirname);
|
||||||
|
setInterval(function () { mouseTrack(mainWindow) }, 1000);
|
||||||
|
}
|
||||||
|
var x = 0
|
||||||
|
var y = 0
|
||||||
|
var unchanged = 0
|
||||||
|
var locked = false
|
||||||
|
function mouseTrack(mainWindow) {
|
||||||
|
let mousePos = electron.screen.getCursorScreenPoint()
|
||||||
|
let xNow = mousePos.x
|
||||||
|
let yNow = mousePos.x
|
||||||
|
if (x != xNow || y != yNow) {
|
||||||
|
unchanged = 0
|
||||||
|
locked = false
|
||||||
|
} else {
|
||||||
|
unchanged++
|
||||||
|
if (unchanged > 60 && !locked) {
|
||||||
|
unchanged = 0
|
||||||
|
locked = true
|
||||||
|
mainWindow.webContents.send('asRead', "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x = xNow
|
||||||
|
y = yNow
|
||||||
}
|
}
|
||||||
// Electronの初期化完了後に実行
|
// Electronの初期化完了後に実行
|
||||||
app.on('ready', createWindow);
|
app.on('ready', createWindow);
|
||||||
|
@ -62,8 +62,8 @@
|
|||||||
"vue": "^2.6.10"
|
"vue": "^2.6.10"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"itunes-nowplaying-mac": "kPherox/itunes-nowplaying-mac#get-artworks-base64",
|
"font-manager": "^0.3.0",
|
||||||
"font-manager": "^0.3.0"
|
"itunes-nowplaying-mac": "kPherox/itunes-nowplaying-mac#get-artworks-base64"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^6.0.0",
|
"electron": "^6.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user