new build method with Apple notarize, electron-build programatic API
This commit is contained in:
@@ -10,7 +10,7 @@ function css(mainWindow) {
|
||||
|
||||
ipc.on('custom-css-create', function (e, arg) {
|
||||
fs.writeFileSync(customcss, arg);
|
||||
e.sender.webContents.send('custom-css-create-complete', "");
|
||||
e.sender.send('custom-css-create-complete', "");
|
||||
})
|
||||
ipc.on('custom-css-request', function (e, arg) {
|
||||
try {
|
||||
@@ -18,16 +18,16 @@ function css(mainWindow) {
|
||||
} catch (e) {
|
||||
var css = "";
|
||||
}
|
||||
e.sender.webContents.send('custom-css-response', css);
|
||||
e.sender.send('custom-css-response', css);
|
||||
})
|
||||
ipc.on('theme-json-create', function (e, arg) {
|
||||
var themecss = join(app.getPath("userData"), JSON5.parse(arg)["id"] +
|
||||
".thedesktheme");
|
||||
fs.writeFileSync(themecss, JSON5.stringify(JSON5.parse(arg)));
|
||||
if (JSON5.parse(arg)["id"]) {
|
||||
e.sender.webContents.send('theme-json-create-complete', "");
|
||||
e.sender.send('theme-json-create-complete', "");
|
||||
} else {
|
||||
e.sender.webContents.send('theme-json-create-complete', "error");
|
||||
e.sender.send('theme-json-create-complete', "error");
|
||||
}
|
||||
})
|
||||
ipc.on('theme-json-delete', function (e, arg) {
|
||||
@@ -35,10 +35,10 @@ function css(mainWindow) {
|
||||
var themecss = join(app.getPath("userData"), arg);
|
||||
console.log(themecss);
|
||||
fs.unlink(themecss, function (err) {
|
||||
e.sender.webContents.send('theme-json-delete-complete', "");
|
||||
e.sender.send('theme-json-delete-complete', "");
|
||||
});
|
||||
} catch {
|
||||
e.sender.webContents.send('theme-json-delete-complete', 'cannot delete');
|
||||
e.sender.send('theme-json-delete-complete', 'cannot delete');
|
||||
}
|
||||
|
||||
})
|
||||
@@ -52,7 +52,7 @@ function css(mainWindow) {
|
||||
var raw = fs.readFileSync(themecss, 'utf8')
|
||||
var json = JSON5.parse(raw)
|
||||
}
|
||||
e.sender.webContents.send('theme-json-response', [json, raw]);
|
||||
e.sender.send('theme-json-response', [json, raw]);
|
||||
})
|
||||
ipc.on('theme-css-request', function (e, arg) {
|
||||
try {
|
||||
@@ -149,7 +149,7 @@ function css(mainWindow) {
|
||||
} else {
|
||||
var css = compatibleTheme(json)
|
||||
}
|
||||
e.sender.webContents.send('theme-css-response', css);
|
||||
e.sender.send('theme-css-response', css);
|
||||
} catch (e) {
|
||||
var css = "";
|
||||
}
|
||||
@@ -270,7 +270,7 @@ function css(mainWindow) {
|
||||
default: false
|
||||
})
|
||||
}
|
||||
e.sender.webContents.send('theme-json-list-response', themes);
|
||||
e.sender.send('theme-json-list-response', themes);
|
||||
})
|
||||
}
|
||||
exports.css = css;
|
||||
|
@@ -41,19 +41,19 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||
//アプデDL
|
||||
ipc.on('download-btn', async (e, args) => {
|
||||
function dl(url, file, dir, e) {
|
||||
e.sender.webContents.send('mess', 'Start...')
|
||||
e.sender.send('mess', 'Start...')
|
||||
const opts = {
|
||||
directory: dir,
|
||||
filename: file,
|
||||
openFolderWhenDone: true,
|
||||
onProgress: function(event) {
|
||||
e.sender.webContents.send('prog', [event, args[2]])
|
||||
e.sender.send('prog', [event, args[2]])
|
||||
},
|
||||
saveAs: false
|
||||
}
|
||||
download(updatewin, url, opts)
|
||||
.then(dl => {
|
||||
e.sender.webContents.send('mess', 'ダウンロードが完了しました。')
|
||||
e.sender.send('mess', 'ダウンロードが完了しました。')
|
||||
app.quit()
|
||||
})
|
||||
.catch(console.error)
|
||||
@@ -111,7 +111,7 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||
filename: name,
|
||||
openFolderWhenDone: false,
|
||||
onProgress: function(e) {
|
||||
event.sender.webContents.send('general-dl-prog', e)
|
||||
event.sender.send('general-dl-prog', e)
|
||||
},
|
||||
saveAs: false
|
||||
}
|
||||
@@ -126,7 +126,7 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||
} else {
|
||||
var name = dir
|
||||
}
|
||||
event.sender.webContents.send('general-dl-message', name)
|
||||
event.sender.send('general-dl-message', name)
|
||||
})
|
||||
.catch(console.error)
|
||||
})
|
||||
|
@@ -26,14 +26,14 @@ function img(mainWindow, dir) {
|
||||
for (var i = 0; i < fileNames.length; i++) {
|
||||
var path = fileNames[i]
|
||||
var bin = fs.readFileSync(path, 'base64')
|
||||
e.sender.webContents.send('resizeJudgement', [bin, 'new'])
|
||||
e.sender.send('resizeJudgement', [bin, 'new'])
|
||||
}
|
||||
})
|
||||
ipc.on('bmp-image', (e, args) => {
|
||||
Jimp.read(args[0], function (err, lenna) {
|
||||
if (err) throw err
|
||||
lenna.getBase64(Jimp.MIME_PNG, function (err, src) {
|
||||
e.sender.webContents.send('bmp-img-comp', [src, args[1]])
|
||||
e.sender.send('bmp-img-comp', [src, args[1]])
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -49,7 +49,7 @@ function img(mainWindow, dir) {
|
||||
Jimp.read(decodedFile, function (err, lenna) {
|
||||
if (err) throw err
|
||||
lenna.scaleToFit(args[1], args[1]).getBase64(Jimp[use], function (err, src) {
|
||||
e.sender.webContents.send('bmp-img-comp', [src, args[1]])
|
||||
e.sender.send('bmp-img-comp', [src, args[1]])
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -71,12 +71,12 @@ function img(mainWindow, dir) {
|
||||
var ave = (color.r + color.g + color.b) / 3
|
||||
if (ave > 128) {
|
||||
image.print(font, left, top, args[1]).getBase64(Jimp.MIME_PNG, function (err, src) {
|
||||
e.sender.webContents.send('bmp-img-comp', [src, args[1], true])
|
||||
e.sender.send('bmp-img-comp', [src, args[1], true])
|
||||
})
|
||||
} else {
|
||||
Jimp.loadFont(Jimp.FONT_SANS_16_WHITE).then((font) => {
|
||||
image.print(font, left, top, args[1]).getBase64(Jimp.MIME_PNG, function (err, src) {
|
||||
e.sender.webContents.send('bmp-img-comp', [src, args[1], true])
|
||||
e.sender.send('bmp-img-comp', [src, args[1], true])
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ function np(mainWindow) {
|
||||
title: title,
|
||||
anynp: true
|
||||
}
|
||||
e.sender.webContents.send('itunes-np', ret)
|
||||
e.sender.send('itunes-np', ret)
|
||||
} else {
|
||||
|
||||
try {
|
||||
@@ -27,16 +27,16 @@ function np(mainWindow) {
|
||||
if(artwork) {
|
||||
const base64 = artwork.toString('base64')
|
||||
value.artwork = base64
|
||||
e.sender.webContents.send('itunes-np', value)
|
||||
e.sender.send('itunes-np', value)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
e.sender.webContents.send('itunes-np', value)
|
||||
e.sender.send('itunes-np', value)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
e.sender.webContents.send('itunes-np', error)
|
||||
e.sender.send('itunes-np', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@@ -36,13 +36,13 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
} catch {
|
||||
var gitHash = null
|
||||
}
|
||||
e.sender.webContents.send('platform', [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron, gitHash])
|
||||
e.sender.send('platform', [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron, gitHash])
|
||||
})
|
||||
//言語
|
||||
ipc.on('lang', function (e, arg) {
|
||||
console.log('set:' + arg)
|
||||
fs.writeFileSync(lang_path, arg)
|
||||
e.sender.webContents.send('langres', arg)
|
||||
e.sender.send('langres', arg)
|
||||
})
|
||||
//エクスポートのダイアログ
|
||||
ipc.on('exportSettings', function (e, args) {
|
||||
@@ -54,7 +54,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
if (!savedFiles) {
|
||||
return false
|
||||
}
|
||||
e.sender.webContents.send('exportSettingsFile', savedFiles)
|
||||
e.sender.send('exportSettingsFile', savedFiles)
|
||||
})
|
||||
//インポートのダイアログ
|
||||
ipc.on('importSettings', function (e, args) {
|
||||
@@ -67,7 +67,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
if (!fileNames) {
|
||||
return false
|
||||
}
|
||||
e.sender.webContents.send('config', JSON5.parse(fs.readFileSync(fileNames[0], 'utf8')))
|
||||
e.sender.send('config', JSON5.parse(fs.readFileSync(fileNames[0], 'utf8')))
|
||||
})
|
||||
//保存フォルダのダイアログ
|
||||
ipc.on('savefolder', function (e, args) {
|
||||
@@ -78,7 +78,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
properties: ['openDirectory'],
|
||||
}
|
||||
)
|
||||
e.sender.webContents.send('savefolder', fileNames[0])
|
||||
e.sender.send('savefolder', fileNames[0])
|
||||
})
|
||||
//カスタムサウンドのダイアログ
|
||||
ipc.on('customSound', function (e, arg) {
|
||||
@@ -93,7 +93,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
],
|
||||
}
|
||||
)
|
||||
e.sender.webContents.send('customSoundRender', [arg, fileNames[0]])
|
||||
e.sender.send('customSoundRender', [arg, fileNames[0]])
|
||||
})
|
||||
|
||||
//ハードウェアアクセラレーションの無効化
|
||||
@@ -134,7 +134,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
//スクリーンリーダー
|
||||
ipc.on('acsCheck', function (e, arg) {
|
||||
if (app.accessibilitySupportEnabled) {
|
||||
mainWindow.webContents.send('accessibility', 'true')
|
||||
mainWindow.send('accessibility', 'true')
|
||||
}
|
||||
})
|
||||
ipc.on('quit', (e, args) => {
|
||||
@@ -198,8 +198,8 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
})
|
||||
function mems() {
|
||||
var mem = os.totalmem() - os.freemem()
|
||||
if (mainWindow && event.webContents) {
|
||||
event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem(), os.cpus().length, os.uptime()])
|
||||
if (mainWindow && event) {
|
||||
event.send('memory', [mem, os.cpus()[0].model, os.totalmem(), os.cpus().length, os.uptime()])
|
||||
}
|
||||
}
|
||||
ipc.on('endmem', (e, arg) => {
|
||||
@@ -210,7 +210,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
|
||||
ipc.on('export', (e, args) => {
|
||||
fs.writeFileSync(args[0], JSON5.stringify(args[1]))
|
||||
e.sender.webContents.send('exportAllComplete', '')
|
||||
e.sender.send('exportAllComplete', '')
|
||||
})
|
||||
//フォント
|
||||
function object_array_sort(data, key, order, fn) {
|
||||
@@ -249,7 +249,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
var SystemFonts = require('system-font-families').default
|
||||
var fm = new SystemFonts()
|
||||
const fontList = fm.getFontsSync()
|
||||
e.sender.webContents.send('font-list', fontList)
|
||||
e.sender.send('font-list', fontList)
|
||||
})
|
||||
//コピー
|
||||
ipc.on('copy', (e, arg) => {
|
||||
@@ -286,7 +286,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
logs = todayLog + yestLog + yest2Log
|
||||
})
|
||||
logs = yest2Log + yestLog + todayLog
|
||||
e.sender.webContents.send('logData', logs)
|
||||
e.sender.send('logData', logs)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -328,7 +328,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
const url = window.webContents.getURL()
|
||||
if (url.match("https://tweetdeck.twitter.com")) {
|
||||
window.close()
|
||||
e.sender.webContents.send('twitterLoginComplete', '')
|
||||
e.sender.send('twitterLoginComplete', '')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user