diff --git a/app/about.html b/app/about.html index 290933a6..b792f66f 100644 --- a/app/about.html +++ b/app/about.html @@ -1,135 +1,139 @@ - + + + TheDesk + + + + + + + + + - .area-data6 { - grid-area: data6; - } - - - - - - - - -
TheDesk
-
-
Display version
-
-
Internal version
-
-
Commit(7chars)
-
-
Chromium
-
-
Electron
-
-
Node.js
-
-
-
Copyright © TheDesk 2018
- Main developer(author): Cutls P
- Thanks:toneji/popn_ja/kPherox and all users - ❤️ -
Web site
- - - \ No newline at end of file + + + + + +
TheDesk
+
+
Display version
+
+
Internal version
+
+
Commit(7chars)
+
+
Chromium
+
+
Electron
+
+
Node.js
+
+
+
+ Copyright © TheDesk 2018
+ Main developer(author): Cutls P
+ Thanks:toneji/popn_ja/kPherox + and all users + ❤️ +
Web site +
+ + + + + diff --git a/app/css/master.css b/app/css/master.css index 01745958..e96f2104 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -563,7 +563,7 @@ textarea { font-family: 'Open Sans'; font-style: normal; font-weight: 300; - src: local('Open Sans Light'), local('OpenSans-Light'), url(https://fonts.gstatic.com/s/opensans/v17/mem5YaGs126MiZpBA-UN_r8OUuhp.woff2) format('woff2'); + src: local('Open Sans Light'), local('OpenSans-Light'), url('./fonts/OpenSans-Light.ttf') format('truetype'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } @font-face { diff --git a/app/css/userdata.css b/app/css/userdata.css index 3d8cc72c..720f273f 100644 --- a/app/css/userdata.css +++ b/app/css/userdata.css @@ -1,7 +1,7 @@ /*アイコンをクリックした時とかにでてくるユーザーデータ*/ #his-data { background-repeat: no-repeat; - background-image: url("../../loading.svg"); + background-image: url("../img/loading.svg"); overflow-y: hidden; } #his-data .btn .material-icons{ diff --git a/app/fonts/OpenSans-Light.ttf b/app/fonts/OpenSans-Light.ttf new file mode 100644 index 00000000..6580d3a1 Binary files /dev/null and b/app/fonts/OpenSans-Light.ttf differ diff --git a/app/img/desk-animation.svg b/app/img/desk-animation.svg new file mode 100644 index 00000000..3dcb09ce --- /dev/null +++ b/app/img/desk-animation.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/img/desk.png b/app/img/desk.png deleted file mode 100644 index 6d8130c9..00000000 Binary files a/app/img/desk.png and /dev/null differ diff --git a/app/img/desk.svg b/app/img/desk.svg index 2f6ef665..faf36314 100644 --- a/app/img/desk.svg +++ b/app/img/desk.svg @@ -1,39 +1,26 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/img/desk512.png b/app/img/desk512.png new file mode 100644 index 00000000..d2d6224d Binary files /dev/null and b/app/img/desk512.png differ diff --git a/app/js/platform/first.js b/app/js/platform/first.js index 6fd6276d..d8b892b5 100644 --- a/app/js/platform/first.js +++ b/app/js/platform/first.js @@ -1,4 +1,3 @@ -document.title = 'TheDesk' $.strip_tags = function(str, allowed) { if (!str) { return '' diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 5afa17d2..37f5dc2d 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -4,6 +4,7 @@ var ipc = electron.ipcRenderer //title bar const customTitlebar = require('custom-electron-titlebar') window.addEventListener('DOMContentLoaded', () => { + document.title = 'TheDesk' ipc.send('acsCheck', '') ipc.send('frameCheck', '') ipc.on('frame', function(event, args) { diff --git a/app/main.js b/app/main.js index 9cbeb9d7..33ac27aa 100644 --- a/app/main.js +++ b/app/main.js @@ -3,6 +3,10 @@ var dir = 'file://' + __dirname var base = dir + '/view/' // Electronのモジュール const electron = require('electron') +// アプリケーションをコントロールするモジュール +const app = electron.app +// Electronの初期化完了後に実行 +app.on('ready', createWindow) const fs = require('fs') const language = require('./main/language.js') const css = require('./main/css.js') @@ -12,9 +16,6 @@ const np = require('./main/np.js') const systemFunc = require('./main/system.js') const Menu = electron.Menu const join = require('path').join - -// アプリケーションをコントロールするモジュール -const app = electron.app // ウィンドウを作成するモジュール const BrowserWindow = electron.BrowserWindow // メインウィンドウはGCされないようにグローバル宣言 @@ -36,60 +37,11 @@ if (!gotTheLock) { }) } -if (process.argv.indexOf('--dev') === -1) { - var packaged = true -} else { - var packaged = false - console.log( - '||\\\\\\ \n' + - '|||| \\\\\\\\ \n' + - '|||| \\\\\\\\ \n' + - '|||| Am I a \\\\\\\\ \n' + - '|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n' + - '|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n' + - "|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n" + - '|||| < _ _) ////// | | | | | | __/ |_| | __/__ \\ < \n' + - '|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n' + - '|||| ///// \n' + - '|||| /////\n' + - '|||| /////\n' + - '||||//////' - ) - console.log('If it does not show the window, you might forget `npm run construct`.') -} -var info_path = join(app.getPath('userData'), 'window-size.json') -var max_info_path = join(app.getPath('userData'), 'max-window-size.json') -var lang_path = join(app.getPath('userData'), 'language') -var ha_path = join(app.getPath('userData'), 'hardwareAcceleration') -var ua_path = join(app.getPath('userData'), 'useragent') -var frame_path = join(app.getPath('userData'), 'frame') -try { - fs.readFileSync(ha_path, 'utf8') - app.disableHardwareAcceleration() - if (!packaged) console.log('disabled: Hardware Acceleration') -} catch { - if (!packaged) console.log('enabled: Hardware Acceleration') -} -var window_size -try { - window_size = JSON.parse(fs.readFileSync(info_path, 'utf8')) -} catch (e) { - window_size = { - width: 1000, - height: 750 - } // デフォルトバリュー -} -var max_window_size -try { - max_window_size = JSON.parse(fs.readFileSync(max_info_path, 'utf8')) -} catch (e) { - max_window_size = { - width: 'string', - height: 'string', - x: 'string', - y: 'string' - } // デフォルトバリュー -} +// 全てのウィンドウが閉じたら終了 +app.on('window-all-closed', function () { + electron.session.defaultSession.clearCache(() => {}) + app.quit() +}) function isFile(file) { try { fs.statSync(file) @@ -98,24 +50,90 @@ function isFile(file) { if (err.code === 'ENOENT') return false } } -try { - var frameRaw = fs.readFileSync(frame_path, 'utf8') - if(frameRaw == 'false') { - var frame = false - var frameTitle = 'hidden' - } else { - var frame = true - var frameTitle = 'default' - } -} catch { - var frame = true -} -// 全てのウィンドウが閉じたら終了 -app.on('window-all-closed', function() { - electron.session.defaultSession.clearCache(() => {}) - app.quit() -}) function createWindow() { + //Opening + const package = fs.readFileSync(__dirname + '/package.json') + const data = JSON.parse(package) + const version = data.version + const codename = data.codename + var openingWindow = new BrowserWindow({ + width: 300, + height: 400, + transparent: false, + frame: false, + resizable: false, + }) + openingWindow.loadURL(`${__dirname}/opening.html?ver=${version}&codename=${codename}`) + + if (process.argv.indexOf('--dev') === -1) { + var packaged = true + } else { + var packaged = false + console.log( + '||\\\\\\ \n' + + '|||| \\\\\\\\ \n' + + '|||| \\\\\\\\ \n' + + '|||| Am I a \\\\\\\\ \n' + + '|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n' + + '|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n' + + "|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n" + + '|||| < _ _) ////// | | | | | | __/ |_| | __/__ \\ < \n' + + '|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n' + + '|||| ///// \n' + + '|||| /////\n' + + '|||| /////\n' + + '||||//////' + ) + console.log('If it does not show the window, you might forget `npm run construct`.') + } + + var info_path = join(app.getPath('userData'), 'window-size.json') + var max_info_path = join(app.getPath('userData'), 'max-window-size.json') + var lang_path = join(app.getPath('userData'), 'language') + var ha_path = join(app.getPath('userData'), 'hardwareAcceleration') + var ua_path = join(app.getPath('userData'), 'useragent') + var frame_path = join(app.getPath('userData'), 'frame') + try { + fs.readFileSync(ha_path, 'utf8') + app.disableHardwareAcceleration() + if (!packaged) console.log('disabled: Hardware Acceleration') + } catch { + if (!packaged) console.log('enabled: Hardware Acceleration') + } + var window_size + try { + window_size = JSON.parse(fs.readFileSync(info_path, 'utf8')) + } catch (e) { + window_size = { + width: 1000, + height: 750, + } // デフォルトバリュー + } + var max_window_size + try { + max_window_size = JSON.parse(fs.readFileSync(max_info_path, 'utf8')) + } catch (e) { + max_window_size = { + width: 'string', + height: 'string', + x: 'string', + y: 'string', + } // デフォルトバリュー + } + + try { + var frameRaw = fs.readFileSync(frame_path, 'utf8') + if (frameRaw == 'false') { + var frame = false + var frameTitle = 'hidden' + } else { + var frame = true + var frameTitle = 'default' + } + } catch { + var frame = true + } + if (isFile(lang_path)) { var lang = fs.readFileSync(lang_path, 'utf8') } else { @@ -132,7 +150,7 @@ function createWindow() { } else { lang = 'en' } - fs.mkdir(app.getPath('userData'), function(err) { + fs.mkdir(app.getPath('userData'), function (err) { fs.writeFileSync(lang_path, lang) }) } @@ -141,59 +159,32 @@ function createWindow() { // メイン画面の表示。ウィンドウの幅、高さを指定できる var platform = process.platform var bit = process.arch + var arg = { + webPreferences: { + webviewTag: true, + nodeIntegration: false, + contextIsolation: true, + preload: join(__dirname, 'js', 'platform', 'preload.js'), + }, + width: window_size.width, + height: window_size.height, + x: window_size.x, + y: window_size.y, + show: false, + frame: frame, + } if (platform == 'linux') { - var arg = { - webPreferences: { - webviewTag: true, - nodeIntegration: false, - contextIsolation: true, - preload: join(__dirname, 'js', 'platform', 'preload.js') - }, - width: window_size.width, - height: window_size.height, - x: window_size.x, - y: window_size.y, - icon: __dirname + '/desk.png', - show: false, - frame: frame, - resizable: true - } + arg.resizable = true + arg.icon = __dirname + '/desk.png' } else if (platform == 'win32') { - var arg = { - webPreferences: { - webviewTag: true, - nodeIntegration: false, - contextIsolation: true, - preload: join(__dirname, 'js', 'platform', 'preload.js') - }, - width: window_size.width, - height: window_size.height, - x: window_size.x, - y: window_size.y, - simpleFullscreen: true, - show: false, - frame: frame - } + arg.simpleFullscreen = true } else if (platform == 'darwin') { - var arg = { - webPreferences: { - webviewTag: true, - nodeIntegration: false, - contextIsolation: true, - preload: join(__dirname, 'js', 'platform', 'preload.js') - }, - width: window_size.width, - height: window_size.height, - x: window_size.x, - y: window_size.y, - simpleFullscreen: true, - show: false, - titleBarStyle: frameTitle, - frame: frame, - } + arg.simpleFullscreen = true + arg.titleBarStyle = frameTitle } mainWindow = new BrowserWindow(arg) mainWindow.once('page-title-updated', () => { + openingWindow.close() mainWindow.show() console.log('Accessibility: ' + app.accessibilitySupportEnabled) if (window_size.max) { @@ -226,40 +217,35 @@ function createWindow() { // Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) thedesk/18.11.3 Chrome/76.0.3809.146 Electron/6.0.12 Safari/537.36 const crypto = require('crypto') const N = 100 - var ua = - 'Mastodon client: ' + - crypto - .randomBytes(N) - .toString('base64') - .substring(0, N) + var ua = 'Mastodon client: ' + crypto.randomBytes(N).toString('base64').substring(0, N) } mainWindow.loadURL(base + lang + '/index.html' + plus, { userAgent: ua }) if (!window_size.x && !window_size.y) { mainWindow.center() } // ウィンドウが閉じられたらアプリも終了 - mainWindow.on('closed', function() { + mainWindow.on('closed', function () { electron.ipcMain.removeAllListeners() mainWindow = null }) closeArg = false - mainWindow.on('close', function(e, arg) { + mainWindow.on('close', function (e, arg) { writePos(mainWindow) if (!closeArg) { e.preventDefault() } - const promise = new Promise(function(resolve) { + const promise = new Promise(function (resolve) { mainWindow.webContents.send('asReadEnd', '') - setTimeout(function() { + setTimeout(function () { resolve() }, 3000) }) - promise.then(function(response) { + promise.then(function (response) { closeArg = true mainWindow.close() }) }) - electron.ipcMain.on('sendMarkersComplete', function(e, arg) { + electron.ipcMain.on('sendMarkersComplete', function (e, arg) { closeArg = true mainWindow.close() }) @@ -275,33 +261,31 @@ function createWindow() { height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y, - max: true + max: true, } } else { var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, - y: mainWindow.getBounds().y + y: mainWindow.getBounds().y, } } fs.writeFileSync(info_path, JSON.stringify(size)) } - mainWindow.on('maximize', function() { + mainWindow.on('maximize', function () { writePos(mainWindow) fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds())) }) - mainWindow.on('minimize', function() { + mainWindow.on('minimize', function () { writePos(mainWindow) mainWindow.webContents.send('asRead', '') }) var platform = process.platform var bit = process.arch - Menu.setApplicationMenu( - Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir, dirname, frame)) - ) - if(!frame) { + Menu.setApplicationMenu(Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir, dirname, frame))) + if (!frame) { mainWindow.setMenu(null) } //CSS @@ -314,7 +298,7 @@ function createWindow() { np.TheDeskNowPlaying(mainWindow) //その他system systemFunc.system(mainWindow, dir, lang, dirname) - setInterval(function() { + setInterval(function () { mouseTrack(mainWindow) }, 1000) } @@ -340,10 +324,5 @@ function mouseTrack(mainWindow) { x = xNow y = yNow } -// Electronの初期化完了後に実行 -app.on('ready', createWindow) -var onError = function(err, response) { - console.error(err, response) -} app.setAsDefaultProtocolClient('thedesk') diff --git a/app/opening.html b/app/opening.html new file mode 100644 index 00000000..49a7a807 --- /dev/null +++ b/app/opening.html @@ -0,0 +1,88 @@ + + + + TheDesk + + + + + + + +

TheDesk

+ +
+
+ Copyright © TheDesk 2018 + +
+ +