Skip to content

Commit

Permalink
ニコ生チャット対応
Browse files Browse the repository at this point in the history
  • Loading branch information
pasta04 committed Jun 26, 2020
1 parent 3592948 commit 0c0b070
Show file tree
Hide file tree
Showing 12 changed files with 936 additions and 76 deletions.
436 changes: 402 additions & 34 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/scripts/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unacast",
"version": "0.5.0",
"version": "0.5.1",
"description": "掲示板のレスをYoutubeコメント風に表示したいという思想の元に開発されるツール",
"main": "dist/index.js",
"scripts": {
Expand All @@ -25,6 +25,7 @@
"dependencies": {
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"cheerio": "^1.0.0-rc.3",
"dank-twitch-irc": "^3.0.7",
"ejs": "^2.7.1",
"electron-log": "^4.1.1",
Expand All @@ -35,6 +36,7 @@
"material-design-lite": "^1.3.0"
},
"devDependencies": {
"@types/cheerio": "^0.22.18",
"@types/ejs": "^3.0.2",
"@types/express": "^4.17.6",
"@types/express-ws": "^3.0.0",
Expand Down
Binary file added public/img/niconico.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ <h5>レス・コメント取得先</h5>
<div class="twitchStatusArea">
<span class="status"><span class="status-label">status:</span><span id="twitch-connection-status">none</span></span>
</div>

<div class="mdl-textfield mdl-js-textfield" style="width: 100%">
<div class="subtitle">ニコニココミュニティID</div>
<div class="labeledInputArea">
<span>https://com.nicovideo.jp/community/</span>
<input class="mdl-textfield__input" type="text" id="text-niconico-id" pattern="^(?!.*http.?:)(?!.*/.*).*$" />
/
</div>
</div>
<div class="niconicoStatusArea">
<span class="status"><span class="status-label">status:</span><span id="niconico-connection-status">none</span></span>
<span class="status"><span class="status-label">liveId:</span><span id="niconico-live-id">none</span></span>
</div>
</div>

<div class="block">
Expand Down
73 changes: 36 additions & 37 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ if (!app.requestSingleInstanceLock()) {
const ss = require('./startServer');
console.trace(ss);

// ウィンドウを作成するモジュール
const BrowserWindow = electron.BrowserWindow;

// メインウィンドウはGCされないようにグローバル宣言
globalThis.electron = {
mainWindow: null as any,
chatWindow: null as any,
seList: [],
twitchChat: null as any,
youtubeChat: null as any,
niconicoChat: null as any,
threadConnectionError: 0,
threadNumber: 0,
commentQueueList: [],
Expand All @@ -65,7 +63,7 @@ if (!app.requestSingleInstanceLock()) {
});

// ウィンドウサイズを(フレームサイズを含まない)設定
const mainWin = new BrowserWindow({
const mainWin = new electron.BrowserWindow({
// 前回起動時のを復元
x: windowState.x,
y: windowState.y,
Expand Down Expand Up @@ -156,41 +154,42 @@ if (!app.requestSingleInstanceLock()) {
createChatWindow();
});

const createChatWindow = () => {
const windowState = windowStateKeeper({
defaultWidth: 400,
defaultHeight: 720,
file: 'chatWindow.json',
});

const chatWindow = new BrowserWindow({
x: windowState.x,
y: windowState.y,
width: windowState.width,
height: windowState.height,
// 音声再生できるようにする
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required');
}

useContentSize: true,
icon: iconPath,
webPreferences: {
nodeIntegration: true,
},
// タスクバーに表示しない
skipTaskbar: true,
// 閉じれなくする
closable: false,
});
windowState.manage(chatWindow);
const createChatWindow = () => {
const windowState = windowStateKeeper({
defaultWidth: 400,
defaultHeight: 720,
file: 'chatWindow.json',
});
const iconPath = path.resolve(__dirname, '../icon.png');

chatWindow.setTitle('unacast');
chatWindow.setMenu(null);
const chatWindow = new electron.BrowserWindow({
x: windowState.x,
y: windowState.y,
width: windowState.width,
height: windowState.height,

useContentSize: true,
icon: iconPath,
webPreferences: {
nodeIntegration: true,
},
// タスクバーに表示しない
skipTaskbar: true,
// 閉じれなくする
closable: false,
});
windowState.manage(chatWindow);

// レンダラーで使用するhtmlファイルを指定する
chatWindow.loadURL(path.resolve(__dirname, '../src/html/chat.html'));
chatWindow.setTitle('unacast');
chatWindow.setMenu(null);

globalThis.electron.chatWindow = chatWindow;
// chatWindow.webContents.openDevTools();
};
// レンダラーで使用するhtmlファイルを指定する
chatWindow.loadURL(path.resolve(__dirname, '../src/html/chat.html'));

// 音声再生できるようにする
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required');
}
globalThis.electron.chatWindow = chatWindow;
// chatWindow.webContents.openDevTools();
};
Loading

0 comments on commit 0c0b070

Please sign in to comment.