From 93d2e8e0d5230ae8b9cf4c36539bb5118ccc648a Mon Sep 17 00:00:00 2001 From: Cutls Date: Sun, 26 May 2019 20:42:52 +0900 Subject: [PATCH] Update to Usamin (18.5.0) --- .travis.yml | 14 ++-- app/build.js | 105 +++++++++++++++++++++++++ app/dist/builder-effective-config.yaml | 4 + app/js/platform/first.js | 3 +- app/js/ui/settings.js | 1 + app/main.js | 6 +- app/main/dl.js | 2 +- app/package.json | 56 +------------ app/view/en/index.html | 21 ++--- app/view/en/setting.html | 2 +- app/view/en/update.html | 8 +- app/view/ja/index.html | 21 ++--- app/view/ja/setting.html | 2 +- app/view/ja/update.html | 8 +- app/view/make/index.sample.html | 14 ++-- app/view/make/make.js | 2 +- app/view/make/update.sample.html | 8 +- app/view/ps/index.html | 21 ++--- app/view/ps/setting.html | 2 +- app/view/ps/update.html | 8 +- 20 files changed, 197 insertions(+), 111 deletions(-) create mode 100644 app/build.js create mode 100644 app/dist/builder-effective-config.yaml diff --git a/.travis.yml b/.travis.yml index c0bf9c4c..ed35be65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ -os: osx +os: + - osx + - linux + - windows language: node_js node_js: - '10.15.2' @@ -7,10 +10,7 @@ before_deploy: - npm install electron-builder -g - cd app - npm install - - electron-builder --mac --x64 -p never - - mv ../build/TheDesk*.dmg ../TheDesk.dmg - - mv ../build/TheDesk*.zip ../TheDesk-darwin-x64.zip - - cd ../ + - npm build deploy: provider: releases # GitHub にリリースするための API KEY を暗号化した値 @@ -18,11 +18,11 @@ deploy: secure: jndR02p5KRTtcJk18b3YsXL2cC+yzEf1AOqXdpWciF8f3lO5oY01jlxd17xdHIcK7VywSsLVZpLToSdqAoIEhJ5OxEQ/FmA3FlmbwwD6ou13gLa4VGIvsBHveCmKGjVu0Z++atIy76tZYU1SOWFWv4B0ZhnVz2ca2VZynvLgw3YNsPJH7rHO966GXgRkGYJAJ4UvLg3sj/iztVh2FSfbUj5IGO1e/JHJO63wAo1MSQtRjkutVgl/djnBLC6vbL4YHkM3Ynpkx/YQEcxwrmeY0Ra8D5yYDq4MNIDMmZahWC+k4u2eA2Cj2ifBFNxbZvTN75vLwRBp6DsTNHsiqkXrSPDBdNeet31RbwTQ6LtsK8jqmL4S/59dmLcj7uCU2WxyBLPbJdbdZWlqW2ZQvfQY8QVAYy7S3MiHQWQN0oP5wqXk89jcgR42ig/zsqFNPpXHM4mExR7l/gDLPg0j9c3XEF6sWtk3FmJN1i4+B+9kn09b6UKlV7EFPKp8XcFNrz4ZcE9/I8lKwsqLVG2jAXIk7Z9LwDRcAmK5eG348X5zwFtOY6raKIvRw2cn92bPnEI+55v8A4WANS2647GFTgxHj30D0d/sOZmJ5BS34zpdWTgE0AlKg7sOqkncjqoW5J5zCh5Ow7b3KXvEvlAts44mAag8tZTectxMP4iguXvTnv4= # Releases ページにアップロードするファイル file: - - TheDesk.dmg - - TheDesk-darwin-x64.zip + - build/TheDesk*.* skip_cleanup: true on: repo: cutls/TheDesk + tags: true branches: only: - master \ No newline at end of file diff --git a/app/build.js b/app/build.js new file mode 100644 index 00000000..4b0ae291 --- /dev/null +++ b/app/build.js @@ -0,0 +1,105 @@ +const builder = require("electron-builder"); +const fs = require('fs'); +const os = process.platform; +const Platform = builder.Platform +const Arch = builder.Arch +const targets = new Map(); +const archToType = new Map(); +const pref = { + productName: "TheDesk", + appId: "top.thedesk", + asarUnpack: [ + "node_modules/itunes-nowplaying-mac" + ], + directories: { + output: "../build/" + }, + win: { + icon: "build/thedesk.ico", + target: [ + "nsis", + "portable", + "appx" + ] + }, + appx: { + identityName: "53491Cutls.TheDesk", + applicationId: "Cutls.TheDesk", + publisherDisplayName: "Cutls", + publisher: "CN=629757F5-A5EE-474F-9562-B304A89A9FD1", + languages: [ + "JA-JP", + "EN-US" + ] + }, + nsis: { + oneClick: false, + allowToChangeInstallationDirectory: true + }, + linux: { + icon: "build/icons", + target: [ + "zip", + "snap" + ], + category: "Network" + }, + mac: { + target: [ + "dmg", + "zip" + ] + }, + electronDownload: { + version: "5.0.1" + }, + electronVersion: "5.0.1" +} +const json = JSON.parse(fs.readFileSync("package.json", 'utf8')); +const version = json.version; + + +if (os == "win32") { + archToType.set(Arch.ia32, []); + targets.set(Platform.WINDOWS, archToType); +} else if (os == "linux") { + archToType.set(Arch.x64, []); + archToType.set(Arch.ia32, []); + targets.set(Platform.LINUX, archToType); +} else if (os == "darwin") { + archToType.set(Arch.x64, []); + targets.set(Platform.MAC, archToType); +} else { + return false +} +builder.build({ + targets: targets, + config: pref +}) + .then(() => { + if (os == "win32") { + fs.renameSync('../build/TheDesk ' + version + '.exe', '../build/TheDesk-ia32.exe'); + fs.renameSync('../build/TheDesk Setup ' + version + '.exe', '../build/TheDesk-setup-ia32.exe'); + retry() + } + }) + .catch((error) => { + // handle error + }) +function retry(){ + const targetsAlt = new Map(); + const archToTypeAlt = new Map(); + targetsAlt.set(Platform.WINDOWS, archToTypeAlt); + archToTypeAlt.set(Arch.x64, []); + builder.build({ + targets: targetsAlt, + config: pref + }) + .then(() => { + fs.renameSync('../build/TheDesk Setup ' + version + '.exe', '../build/TheDesk-setup.exe'); + fs.renameSync('../build/TheDesk ' + version + '.exe', '../build/TheDesk.exe'); + }) + .catch((error) => { + // handle error + }) +} \ No newline at end of file diff --git a/app/dist/builder-effective-config.yaml b/app/dist/builder-effective-config.yaml new file mode 100644 index 00000000..8dcc43f1 --- /dev/null +++ b/app/dist/builder-effective-config.yaml @@ -0,0 +1,4 @@ +directories: + output: dist + buildResources: build +electronVersion: 1.4.13 diff --git a/app/js/platform/first.js b/app/js/platform/first.js index 16418b29..20e3e8ad 100644 --- a/app/js/platform/first.js +++ b/app/js/platform/first.js @@ -192,4 +192,5 @@ $.mb_substr = function (str, begin, end) { } } return ret; -}; \ No newline at end of file +}; +localStorage.removeItem("errors"); \ No newline at end of file diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index 607b272a..78e6cd29 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -127,6 +127,7 @@ function load() { $("#c2-file").text(localStorage.getItem("custom2")); $("#c3-file").text(localStorage.getItem("custom3")); $("#c4-file").text(localStorage.getItem("custom4")); + //$("#log").val(localStorage.getItem("errors")) } function climute() { diff --git a/app/main.js b/app/main.js index c8443ead..42ab82ad 100644 --- a/app/main.js +++ b/app/main.js @@ -94,11 +94,11 @@ function createWindow() { var platform = process.platform; var bit = process.arch; if (platform == "linux") { - var arg = {webPreferences: {webviewTag: true, nodeIntegration:true}, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, icon: __dirname + '/desk.png' } + var arg = { webPreferences: { webviewTag: true, nodeIntegration: true }, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, icon: __dirname + '/desk.png' } } else if (platform == "win32") { - var arg = {webPreferences: {webviewTag: true, nodeIntegration:true},width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } + var arg = {webPreferences: { webviewTag: true, nodeIntegration: true }, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } } else if (platform == "darwin") { - var arg = {webPreferences: {webviewTag: true, nodeIntegration:true}, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } + var arg = { webPreferences: { webviewTag: true, nodeIntegration: true }, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true } } mainWindow = new BrowserWindow(arg); electron.session.defaultSession.clearCache(() => { }) diff --git a/app/main/dl.js b/app/main/dl.js index 2baefeac..b2ce8d79 100644 --- a/app/main/dl.js +++ b/app/main/dl.js @@ -79,7 +79,7 @@ function dl(mainWindow, lang_path, base) { }, saveAs: false }; - download(BrowserWindow.getFocusedWindow(), + download(updatewin, url, opts) .then(dl => { updatewin.webContents.send('mess', "ダウンロードが完了しました。"); diff --git a/app/package.json b/app/package.json index d4410379..7a14f910 100644 --- a/app/package.json +++ b/app/package.json @@ -1,15 +1,13 @@ { "name": "thedesk", - "version": "18.4.0", + "version": "18.5.0", "description": "TheDesk is a Mastodon client for PC.", "repository": "https://github.com/cutls/TheDesk", "main": "main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dist": "build --linux snap", - "build": "electron-builder", - "build:all": "electron-builder --win --linux", - "build:win": "electron-builder --win" + "build": "node build.js" }, "keywords": [ "mastodon", @@ -58,56 +56,6 @@ "itunes-nowplaying-mac": "git+https://github.com/rinsuki/itunes-nowplaying-mac#pull/4/head", "font-manager": "^0.3.0" }, - "build": { - "productName": "TheDesk", - "appId": "top.thedesk", - "asarUnpack": [ - "node_modules/itunes-nowplaying-mac" - ], - "directories": { - "output": "../build" - }, - "win": { - "icon": "build/thedesk.ico", - "target": [ - "nsis", - "portable", - "appx" - ] - }, - "appx": { - "identityName": "53491Cutls.TheDesk", - "applicationId": "Cutls.TheDesk", - "publisherDisplayName": "Cutls", - "publisher": "CN=629757F5-A5EE-474F-9562-B304A89A9FD1", - "languages": [ - "JA-JP", - "EN-US" - ] - }, - "nsis": { - "oneClick": false, - "allowToChangeInstallationDirectory": true, - "artifactName": "TheDesk-setup.${ext}" - }, - "linux": { - "icon": "build/icons", - "target": [ - "zip" - ], - "category": "Network" - }, - "mac": { - "target": [ - "dmg", - "zip" - ] - }, - "electronDownload": { - "version": "5.0.1" - }, - "electronVersion": "5.0.1" - }, "devDependencies": { "electron": "^5.0.1", "electron-builder": "^20.40.2" diff --git a/app/view/en/index.html b/app/view/en/index.html index 9dcb3911..6100831e 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -36,7 +36,7 @@ @@ -134,7 +137,7 @@ } var electron = require("electron"); var ipc = electron.ipcRenderer; - const shell = electron.shell; + //var shell = electron.shell; verck(); function update(sel) { $("#box").toggleClass("show"); @@ -181,6 +184,7 @@ } else if (sel == "mac") { var url = json["mac"]; shell.openExternal(url); + return false; } ipc.send('download-btn', [url, file]); }); @@ -191,7 +195,7 @@ } ipc.on('prog', function (event, arg) { console.log(arg); - $("body").css('background', 'linear-gradient(#fff 0%,#fff ' + (1 - arg) * 100 + '%, #d7ccc8 ' + (1 - arg) * 100 + '%, #d7ccc8 100%)'); + $(".determinate").css("width",arg*100+"%"); $("#prog").text(Math.floor(arg * 100) + "%"); }) ipc.on('mess', function (event, arg) { diff --git a/app/view/ja/index.html b/app/view/ja/index.html index caf2e942..8b9ed366 100644 --- a/app/view/ja/index.html +++ b/app/view/ja/index.html @@ -36,7 +36,7 @@ @@ -134,7 +137,7 @@ } var electron = require("electron"); var ipc = electron.ipcRenderer; - const shell = electron.shell; + //var shell = electron.shell; verck(); function update(sel) { $("#box").toggleClass("show"); @@ -181,6 +184,7 @@ } else if (sel == "mac") { var url = json["mac"]; shell.openExternal(url); + return false; } ipc.send('download-btn', [url, file]); }); @@ -191,7 +195,7 @@ } ipc.on('prog', function (event, arg) { console.log(arg); - $("body").css('background', 'linear-gradient(#fff 0%,#fff ' + (1 - arg) * 100 + '%, #d7ccc8 ' + (1 - arg) * 100 + '%, #d7ccc8 100%)'); + $(".determinate").css("width",arg*100+"%"); $("#prog").text(Math.floor(arg * 100) + "%"); }) ipc.on('mess', function (event, arg) { diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index 9a96ab75..637eb4a0 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -675,19 +675,21 @@ HP
GitHub

-