Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several bug fixes & enhancements #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function pack(cb, silent) {
/^\/Console-Lite-/,
], // Ignores databases, files and artifacts
icon: path.join(__dirname, '../images/icon'),
win32metadata: {
'requested-execution-level': 'requireAdministrator',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closes #19

},
};

if(process.env.ELECTRON_MIRROR)
Expand Down
21 changes: 20 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const electron = require('electron');
const { ipcMain, app, protocol, globalShortcut, BrowserWindow } = electron;
const { ipcMain, app, protocol, globalShortcut, BrowserWindow, screen } = electron;
const path = require('path');
const tar = require('tar');
const fs = require('fs');
Expand Down Expand Up @@ -65,10 +65,29 @@ function initProjector() {
// Ensures that previous windows are closed
if(projector) projector.close();

const displays = screen.getAllDisplays();
let shouldFillScreen = false;
if(displays.length <= 1) {
projectorOpt.x = 0;
projectorOpt.y = 0;
} else
for(let i = 0; i < displays.length; i++)
if(displays[i].bounds.x !== 0 || displays[i].bounds.y !== 0) {
const externalDisp = displays[i];
projectorOpt.x = externalDisp.bounds.x;
projectorOpt.y = externalDisp.bounds.y;
shouldFillScreen = true;
break;
}

projector = new BrowserWindow(projectorOpt);
projector.loadURL(`file://${__dirname}/projector/index.html`);
util.applyProjectorMenu(projector);

projector.webContents.on('dom-ready', () => {
if(shouldFillScreen && projector.isMaximizable()) projector.maximize();
});

projector.on('closed', () => {
projector = null;
if(controller) controller.webContents.send('projectorClosed');
Expand Down
6 changes: 6 additions & 0 deletions projector/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const desc = {

list: null,
stashedlist: null,
titleSize: 'small',
},

mounted() {
Expand All @@ -54,6 +55,11 @@ const desc = {
ipcRenderer.send('projectorInitialized');
},

toggleTitleSize() {
if(this.$data.titleSize === 'small') this.$data.titleSize = 'big';
else this.$data.titleSize = 'small';
},

_scrollSmooth(el, to) {
const current = el.scrollLeft;
const startTime = performance.now();
Expand Down
31 changes: 18 additions & 13 deletions projector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</div>

<transition name="opacity">
<div class="bottom-bar" v-show="connected">
<div class="bottom-title small">
<div class="top-bar" v-show="connected">
<div class="top-title small">
<span>{{ conf }}</span>
</div>
<div class="counter-group">
Expand All @@ -35,7 +35,7 @@
<div class="counter-indicator-value">{{ twoThirdCount }}</div>
</div>
<div class="counter-indicator">
<div class="counter-indicator-hint">20%多数</div>
<div class="counter-indicator-hint">20%</div>
<div class="counter-indicator-value">{{ twentyPercentCount }}</div>
</div>
</div>
Expand All @@ -53,8 +53,8 @@
</div>

<div class="layer file-layer full" v-show="mode === 'file'">
<div class="bottom-bar">
<div class="bottom-title">
<div class="top-bar">
<div class="top-title">
<i class="material-icons">insert_drive_file</i><span>{{ shortName }}</span>
</div>
</div>
Expand All @@ -69,8 +69,8 @@
</div>

<div class="layer full vote-layer" v-if="mode === 'vote' && vote">
<div class="bottom-bar">
<div class="bottom-title">
<div class="top-bar">
<div class="top-title">
<i class="material-icons">thumbs_up_down</i><span>{{ vote.name }}</span>
</div>
<div class="vote-iteration" v-if="vote.status.iteration > 0">
Expand Down Expand Up @@ -153,23 +153,28 @@
</div>

<div class="layer list-layer full" v-if="mode === 'list'">
<div class="bottom-bar">
<div class="bottom-title small">
<i class="material-icons">record_voice_over</i><span>{{ list.name }}</span>
<div class="top-bar">
<div class="top-title small clickable" @click="toggleTitleSize()" v-if="titleSize === 'small'">
<i class="material-icons">record_voice_over</i>
<span>{{ list.name }}</span>
</div>
<div class="speaker-indicator" v-if="list.ptr < list.seats.length">
<div class="top-title big clickable" @click="toggleTitleSize()" v-if="titleSize === 'big'">
<i class="material-icons">record_voice_over</i>
<span>{{ list.name }}</span>
</div>
<div class="speaker-indicator" v-if="list.ptr < list.seats.length && titleSize === 'small'">
<span class="speaker-current">
{{ list.seats[list.ptr].name }}
</span>
<span class="speaker-next" v-if="list.ptr < list.seats.length - 1">
{{ list.seats[list.ptr + 1].name }}
</span>
</div>
<div class="timer-current" v-if="list.timerCurrent">
<div class="timer-current" v-if="list.timerCurrent && titleSize === 'small'">
<i class="material-icons">person</i>
<timer :time="list.timerCurrent.left" :fix-minute="true"></timer>
</div>
<div class="timer-total" v-if="list.timerTotal && list.timerTotal.value > 0">
<div class="timer-total" v-if="list.timerTotal && list.timerTotal.value > 0 && titleSize === 'small'">
<i class="material-icons">access_time</i>
<timer :time="list.timerTotal.left" :fix-minute="true"></timer>
</div>
Expand Down
24 changes: 16 additions & 8 deletions projector/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ body {
bottom: 0;
}

.bottom-bar {
.top-bar {
position: absolute;
bottom: 0;
top: 0;
right: 0;
left: 0;
height: 12.5vw;
box-sizing: border-box;
border-top: rgba(0,0,0,.12) .125vw solid;
border-bottom: rgba(0,0,0,.12) .125vw solid;

display: flex;
align-items: center;
padding: 0 5vw;
}

.bottom-title {
.top-title {
font-size: 4vw;
overflow: hidden;
display: flex;
Expand All @@ -69,16 +69,24 @@ body {
white-space: nowrap;
}

.bottom-title > span {
.top-title > span {
overflow: hidden;
text-overflow: ellipsis;
}

.bottom-title.small {
.top-title.small {
font-size: 3vw;
}

.bottom-title .material-icons {
.top-title.big {
font-size: 5vw;
}

.top-title.clickable {
cursor: pointer;
}

.top-title .material-icons {
margin-right: 2vw;
font-size: 4vw;
}
Expand All @@ -87,7 +95,7 @@ body {
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 12.5vw;
padding-top: 12.5vw;
}

.brand {
Expand Down
2 changes: 1 addition & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function checkForUpdate() {
return new Promise((resolve, reject) => {
if(!_mc) _mc = new Minio.Client({
endPoint: 'store.bjmun.org',
secure: true,
useSSL: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secure option is deprecated:

Error: "secure" option deprecated, "useSSL" should be used instead
    at new Client (/Users/jiejiss/Work/git/Console-Lite/node_modules/minio/dist/main/minio.js:113:53)
    at Promise (/Users/jiejiss/Work/git/Console-Lite/util.js:244:20)
    at ...

});

fs.readFile(path.join(__dirname, 'VERSION'), (err, buf) => {
Expand Down
Loading