mirror of
https://github.com/S2-/gitlit
synced 2025-08-02 20:30:05 +02:00
Compare commits
19 Commits
v2.0.3
...
16138409f9
Author | SHA1 | Date | |
---|---|---|---|
16138409f9
|
|||
f604749ce8
|
|||
a259bd3e14
|
|||
e3ed1c6e44
|
|||
5d60c8baac
|
|||
8afc7fdac1
|
|||
e934617a03
|
|||
9f696e12f9
|
|||
b326c45593
|
|||
c905040f0e
|
|||
a171760bd6
|
|||
ce50a38e35
|
|||
133f72df2a
|
|||
bebaf95f70
|
|||
e719261427
|
|||
1fe4d0d90c
|
|||
9873246826
|
|||
b8a94f650f
|
|||
e97a5c1fc2
|
@@ -46,7 +46,7 @@ npm run dist
|
|||||||
```
|
```
|
||||||
|
|
||||||
## notes
|
## notes
|
||||||
Since version 2.0.1 the app auto updates itself.
|
Since version 2.0.1 the app auto updates itself using the [github-app-updater](https://www.npmjs.com/package/github-app-updater).
|
||||||
|
|
||||||
## license
|
## license
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
@@ -11,15 +13,18 @@
|
|||||||
//update stuff
|
//update stuff
|
||||||
ipcRenderer.on('update', (event, state) => {
|
ipcRenderer.on('update', (event, state) => {
|
||||||
if (state.event === 'updateAvailable') {
|
if (state.event === 'updateAvailable') {
|
||||||
$('.js-updatenotice').text(`New version ${state.version} available. Downloading...`);
|
$('.js-updatenotice').text(`New version ${state.version} available. Click here to download.`);
|
||||||
$('.js-updatenotice').prop('disabled', true);
|
|
||||||
$('.js-updatenotice').show();
|
$('.js-updatenotice').show();
|
||||||
|
$('.js-updatenotice').prop('disabled', false);
|
||||||
|
$('.js-updatenotice').prop('state', 'ready-to-download');
|
||||||
|
$('.js-updatenotice').data('asset', state.asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.event === 'updateReadyToInstall') {
|
if (state.event === 'updateReadyToInstall') {
|
||||||
$('.js-updatenotice').text(`New version ready to install. Click here to start installer.`);
|
$('.js-updatenotice').text(`New version ready to install. Click here to start installer.`);
|
||||||
$('.js-updatenotice').show();
|
$('.js-updatenotice').show();
|
||||||
$('.js-updatenotice').prop('disabled', false);
|
$('.js-updatenotice').prop('disabled', false);
|
||||||
|
$('.js-updatenotice').prop('state', 'ready-to-install');
|
||||||
$('.js-updatenotice').data('file', state.file);
|
$('.js-updatenotice').data('file', state.file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -29,9 +34,16 @@
|
|||||||
if ($('.js-updatenotice').prop('disabled')) {
|
if ($('.js-updatenotice').prop('disabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('.js-updatenotice').prop('disabled', true);
|
|
||||||
$('.js-updatenotice').text(`Launching installer...`);
|
if ($('.js-updatenotice').prop('state') === 'ready-to-download') {
|
||||||
ipcRenderer.send('installUpdate', $('.js-updatenotice').data('file'));
|
$('.js-updatenotice').prop('disabled', true);
|
||||||
|
$('.js-updatenotice').text(`Downloading new version...`);
|
||||||
|
ipcRenderer.send('downloadUpdate', $('.js-updatenotice').data('asset'));
|
||||||
|
} else if ($('.js-updatenotice').prop('state') === 'ready-to-install') {
|
||||||
|
$('.js-updatenotice').prop('disabled', true);
|
||||||
|
$('.js-updatenotice').text(`Launching installer...`);
|
||||||
|
ipcRenderer.send('installUpdate', $('.js-updatenotice').data('file'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//end update stuff
|
//end update stuff
|
||||||
|
|
||||||
@@ -121,12 +133,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) => {
|
||||||
|
73
app/main.js
73
app/main.js
@@ -15,35 +15,42 @@ let repoDir = path.resolve(path.normalize(args._.join(' ')));
|
|||||||
let repoRootDir = repoDir;
|
let repoRootDir = repoDir;
|
||||||
|
|
||||||
//auto update stuff
|
//auto update stuff
|
||||||
setTimeout(() => {
|
if (process.platform === 'win32') {
|
||||||
gau.checkForUpdate({
|
setTimeout(() => {
|
||||||
currentVersion: app.getVersion(),
|
gau.checkForUpdate({
|
||||||
repo: 'https://api.github.com/repos/S2-/gitlit/releases/latest',
|
currentVersion: app.getVersion(),
|
||||||
assetMatch: /.+setup.+exe/i
|
repo: 'https://api.github.com/repos/S2-/gitlit/releases/latest',
|
||||||
});
|
assetMatch: /.+setup.+exe/i
|
||||||
|
|
||||||
gau.onUpdateAvailable = (version, asset) => {
|
|
||||||
win.webContents.send('update', {
|
|
||||||
event: 'updateAvailable',
|
|
||||||
version: version
|
|
||||||
});
|
});
|
||||||
gau.downloadNewVersion(asset);
|
|
||||||
};
|
|
||||||
|
|
||||||
gau.onNewVersionReadyToInstall = (file) => {
|
gau.onUpdateAvailable = (version, asset) => {
|
||||||
win.webContents.send('update', {
|
win.webContents.send('update', {
|
||||||
event: 'updateReadyToInstall',
|
event: 'updateAvailable',
|
||||||
file: file
|
version: version,
|
||||||
});
|
asset: asset
|
||||||
};
|
});
|
||||||
|
};
|
||||||
|
|
||||||
ipcMain.on('installUpdate', (event, file) => {
|
gau.onNewVersionReadyToInstall = (file) => {
|
||||||
gau.executeUpdate(file);
|
win.webContents.send('update', {
|
||||||
win.webContents.send('update', {
|
event: 'updateReadyToInstall',
|
||||||
event: 'updateInstalling'
|
file: file
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ipcMain.on('downloadUpdate', (event, asset) => {
|
||||||
|
gau.downloadNewVersion(asset);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}, 5000);
|
ipcMain.on('installUpdate', (event, file) => {
|
||||||
|
gau.executeUpdate(file);
|
||||||
|
win.webContents.send('update', {
|
||||||
|
event: 'updateInstalling'
|
||||||
|
});
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
//end update stuff
|
//end update stuff
|
||||||
|
|
||||||
@@ -160,7 +167,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.
|
||||||
@@ -257,9 +272,3 @@ ipcMain.on('restart', (event, newRepoDir) => {
|
|||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
startup(createWindow);
|
startup(createWindow);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('window-all-closed', function() {
|
|
||||||
if (process.platform != 'darwin') {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
@@ -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>
|
||||||
|
2804
package-lock.json
generated
2804
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlit",
|
"name": "gitlit",
|
||||||
"version": "2.0.3",
|
"version": "2.0.12",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app/main.js",
|
"main": "app/main.js",
|
||||||
"build": {
|
"build": {
|
||||||
@@ -27,13 +27,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"animate.css": "^3.5.2",
|
"animate.css": "^4.1.1",
|
||||||
"bootstrap": "^4.5.0",
|
"bootstrap": "^4.5.3",
|
||||||
"ejs": "^2.7.4",
|
"ejs": "^3.1.5",
|
||||||
"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.5",
|
||||||
"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": "^11.0.4",
|
||||||
"electron-builder": "^20.44.4"
|
"electron-builder": "^22.9.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
|
Reference in New Issue
Block a user