This commit is contained in:
khk 2020-02-12 18:45:59 +09:00
commit 6807b5d78f
9 changed files with 122 additions and 14 deletions

View File

@ -14,6 +14,8 @@ import fse from 'fs-extra';
import semver from 'semver';
import os from 'os';
import ChildProcess from 'child_process';
import * as url from 'url';
import * as tmp from 'tmp';
import AutoLaunch from 'auto-launch';
@ -31,7 +33,8 @@ import {
MessengerChannel,
MessageChannel,
AppChannel,
ClipboardChannel
ClipboardChannel,
ExternalChannel
} from '@ucap-webmessenger/native-electron';
import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification';
import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window';
@ -92,6 +95,8 @@ let preventQuit = false;
let notificationService: ElectronNotificationService | null;
let updateWindowService: ElectronUpdateWindowService | null;
tmp.setGracefulCleanup();
function handleUncaughtException(error: Error) {
preventQuit = true;
@ -773,6 +778,40 @@ ipcMain.on(AppChannel.Exit, (event: IpcMainEvent, ...args: any[]) => {
appExit();
});
ipcMain.on(ExternalChannel.OpenUrl, (event: IpcMainEvent, ...args: any[]) => {
const targetUrl = args[0];
const options = JSON.stringify(args[1] || {});
tmp.file({ postfix: '.html' }, (err, name, fd, cb) => {
fse.writeFileSync(
name,
`
<!DOCTYPE html>
<html>
<head>
<title>DS Talk Link</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript">
function onClick() {
const url = '${targetUrl}';
const options = ${options} || {};
window.open(url, !!options.name ? options.name : 'dstalklink', options.features, options.replace);
window.close();
}
</script>
</head>
<body><button onclick="onClick()"><button></body>
</html>
`
);
shell.openExternal(name);
});
});
autoUpdater.on('checking-for-update', () => {
log.info('Checking for update...');
});

56
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "ucap-webmessenger",
"version": "0.0.17",
"version": "0.0.19",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -3494,6 +3494,12 @@
"integrity": "sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==",
"dev": true
},
"@types/tmp": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.1.0.tgz",
"integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA==",
"dev": true
},
"@types/tween.js": {
"version": "17.2.0",
"resolved": "https://registry.npmjs.org/@types/tween.js/-/tween.js-17.2.0.tgz",
@ -7615,6 +7621,17 @@
"chardet": "^0.7.0",
"iconv-lite": "^0.4.24",
"tmp": "^0.0.33"
},
"dependencies": {
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
}
}
},
"extglob": {
@ -10449,6 +10466,15 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
},
"to-regex-range": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
@ -15119,12 +15145,23 @@
}
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
"rimraf": "^2.6.3"
},
"dependencies": {
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
}
}
},
"to-array": {
@ -15694,6 +15731,15 @@
"yallist": "^2.1.2"
}
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "ucap-webmessenger",
"version": "0.0.19",
"version": "0.0.20",
"author": {
"name": "LG CNS",
"email": "lgucap@lgcns.com"
@ -95,6 +95,7 @@
"@types/moment-timezone": "^0.5.12",
"@types/node": "^10.17.13",
"@types/semver": "^6.2.0",
"@types/tmp": "^0.1.0",
"@types/uglifyjs-webpack-plugin": "^1.1.0",
"@types/webpack": "^4.41.2",
"@types/webpack-merge": "^4.1.5",
@ -142,6 +143,7 @@
"protractor": "~5.4.0",
"queueing-subject": "^0.3.4",
"rimraf": "^3.0.0",
"tmp": "^0.1.0",
"ts-node": "~7.0.0",
"tsickle": "^0.37.1",
"tslib": "^1.10.0",

View File

@ -20,7 +20,10 @@
{{ data.notice.regDate }}
</div>
<perfect-scrollbar>
<p [innerHTML]="data.notice.content | linky" class="contnets"></p>
<p
[innerHTML]="data.notice.content | linefeedtohtml | linky"
class="contnets"
></p>
</perfect-scrollbar>
</mat-card-content>
<mat-card-actions class="button-farm flex-row">

View File

@ -411,7 +411,10 @@ export class TopBarComponent implements OnInit, OnDestroy {
.replace(/(\(%USER_ID%\))/g, loginId)
.replace(/(\(%USER_PASS%\))/g, loginPw);
this.nativeService.openDefaultBrowser(url);
this.nativeService.openDefaultBrowser(url, {
features:
'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=400,height=400'
});
}
onClosedProfileMenu() {

View File

@ -277,7 +277,10 @@ export class BrowserNativeService extends NativeService {
return new TranslateLoaderService(this, prefix, suffix);
}
openDefaultBrowser(url: string): void {
openDefaultBrowser(
url: string,
options?: { name?: string; features?: string; replace?: boolean }
): void {
open(url);
}

View File

@ -24,7 +24,8 @@ import {
MessageChannel,
ProcessChannel,
AppChannel,
ClipboardChannel
ClipboardChannel,
ExternalChannel
} from '../types/channel.type';
import { Injectable } from '@angular/core';
import { TranslateLoaderService } from '../translate/electron-loader';
@ -467,8 +468,12 @@ export class ElectronNativeService implements NativeService {
return new TranslateLoaderService(this, prefix, suffix);
}
openDefaultBrowser(url: string): void {
this.shell.openExternal(url);
openDefaultBrowser(
url: string,
options?: { name?: string; features?: string; replace?: boolean }
): void {
// shell.openExternal(url);
this.ipcRenderer.send(ExternalChannel.OpenUrl, url, options);
}
readFromClipboard(): Promise<{

View File

@ -62,3 +62,7 @@ export enum ClipboardChannel {
export enum AppChannel {
Exit = 'UCAP::app::exit'
}
export enum ExternalChannel {
OpenUrl = 'UCAP::external::openUrl'
}

View File

@ -87,7 +87,10 @@ export abstract class NativeService {
suffix?: string
): TranslateLoader;
abstract openDefaultBrowser(url: string): void;
abstract openDefaultBrowser(
url: string,
options?: { name?: string; features?: string; replace?: boolean }
): void;
abstract readFromClipboard(): Promise<{
text?: string;