1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-02 12:20:05 +02:00

update to latest electron version

This commit is contained in:
s2
2020-07-07 10:40:27 +02:00
parent 1fe4d0d90c
commit e719261427
5 changed files with 1031 additions and 1566 deletions

View File

@@ -2,6 +2,8 @@
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote; const remote = require('electron').remote;
const electronFind = require('electron-find'); const electronFind = require('electron-find');
const dialog = remote.require('electron').dialog;
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents()); let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
let firstRun = true; let firstRun = true;
@@ -121,12 +123,15 @@
$(document).on('click', '.js-open-folder', (ev) => { $(document).on('click', '.js-open-folder', (ev) => {
ev.preventDefault(); ev.preventDefault();
$('.js-open-folder-input').trigger('click');
});
$(document).on('change', '.js-open-folder-input', (ev) => { dialog.showOpenDialog({
ev.preventDefault(); properties: ['openDirectory']
ipcRenderer.send('restart', $('.js-open-folder-input')[0].files[0].path); })
.then((path) => {
if (path && path.filePaths.length > 0) {
ipcRenderer.send('restart', path.filePaths[0]);
};
});
}); });
$(document).on('keypress', (ev) => { $(document).on('keypress', (ev) => {

View File

@@ -162,7 +162,15 @@ function loadRepoPage() {
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.
win = new BrowserWindow({title: 'gitlit v' + app.getVersion(), width: 800, height: 700}); win = new BrowserWindow({
title: 'gitlit v' + app.getVersion(),
width: 800,
height: 700,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
}
});
win.setMenu(null); win.setMenu(null);
// and load the index.html of the app. // and load the index.html of the app.

View File

@@ -1,4 +1,3 @@
<div class="text-center"> <div class="text-center">
<a class="btn btn-primary js-open-folder" href="javascript:///">Open another folder</a> <a class="btn btn-primary js-open-folder" href="javascript:///">Open another folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div> </div>

2563
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -29,11 +29,11 @@
"dependencies": { "dependencies": {
"animate.css": "^3.5.2", "animate.css": "^3.5.2",
"bootstrap": "^4.5.0", "bootstrap": "^4.5.0",
"ejs": "^2.7.4", "ejs": "^3.1.3",
"ejs-render-remote": "^1.0.13", "ejs-render-remote": "^1.0.13",
"electron-find": "^1.0.6", "electron-find": "^1.0.6",
"electron-localshortcut": "^3.2.1", "electron-localshortcut": "^3.2.1",
"github-app-updater": "^1.0.2", "github-app-updater": "^1.0.4",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"material-design-icons": "^3.0.1", "material-design-icons": "^3.0.1",
"minimist": "^1.2.5", "minimist": "^1.2.5",
@@ -42,8 +42,8 @@
"popper.js": "^1.16.1" "popper.js": "^1.16.1"
}, },
"devDependencies": { "devDependencies": {
"electron": "^3.1.13", "electron": "^9.1.0",
"electron-builder": "^20.44.4" "electron-builder": "^22.7.0"
}, },
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",