mirror of
https://github.com/S2-/gitlit
synced 2025-08-02 20:30:05 +02:00
Compare commits
41 Commits
v1.5.1
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0fa715247d | ||
44b4183597
|
|||
cfce0edaa9
|
|||
5edd143318
|
|||
e576161518
|
|||
7a63056ef3
|
|||
efd9d13454
|
|||
9836f5c918
|
|||
6c9787fea1
|
|||
16138409f9
|
|||
f604749ce8
|
|||
a259bd3e14
|
|||
e3ed1c6e44
|
|||
5d60c8baac
|
|||
8afc7fdac1
|
|||
e934617a03
|
|||
9f696e12f9
|
|||
b326c45593
|
|||
c905040f0e
|
|||
a171760bd6
|
|||
ce50a38e35
|
|||
133f72df2a
|
|||
bebaf95f70
|
|||
e719261427
|
|||
1fe4d0d90c
|
|||
9873246826
|
|||
b8a94f650f
|
|||
e97a5c1fc2
|
|||
3d020a3ddd
|
|||
8765f99f19
|
|||
cee594fcd9
|
|||
3c4d33eb83
|
|||
48b5f33eb9
|
|||
64b500f414
|
|||
caeaab14b8
|
|||
94e7c5ce71
|
|||
cdafb7a006
|
|||
6c2bc3397e
|
|||
a6666452d7
|
|||
e9feebce51
|
|||
510e4786b7
|
@@ -45,6 +45,9 @@ npm install
|
|||||||
npm run dist
|
npm run dist
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## notes
|
||||||
|
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
|
||||||
|
|
||||||
ISC
|
ISC
|
||||||
|
@@ -49,3 +49,13 @@ table.sortable thead {
|
|||||||
table.sortable .sorttable_nosort {
|
table.sortable .sorttable_nosort {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* updater
|
||||||
|
*/
|
||||||
|
.updatenotice {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 5px;
|
||||||
|
right: 5px;
|
||||||
|
}
|
||||||
|
@@ -20,8 +20,9 @@
|
|||||||
<link href="css/app.css" rel="stylesheet">
|
<link href="css/app.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="js-container">
|
<div class="js-container"></div>
|
||||||
</div>
|
|
||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
|
|
||||||
|
<div class="js-updatenotice btn btn-warning btn-sm updatenotice" style="display:none" disabled>Update ready to install</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -2,11 +2,53 @@
|
|||||||
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;
|
||||||
|
const shell = require('electron').shell;
|
||||||
|
|
||||||
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
|
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
|
||||||
|
|
||||||
let firstRun = true;
|
let firstRun = true;
|
||||||
|
|
||||||
//events
|
//events
|
||||||
|
|
||||||
|
//update stuff
|
||||||
|
ipcRenderer.on('update', (event, state) => {
|
||||||
|
if (state.event === 'updateAvailable') {
|
||||||
|
$('.js-updatenotice').text(`New version ${state.version} available. Click here to download.`);
|
||||||
|
$('.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') {
|
||||||
|
$('.js-updatenotice').text(`New version ready to install. Click here to start installer.`);
|
||||||
|
$('.js-updatenotice').show();
|
||||||
|
$('.js-updatenotice').prop('disabled', false);
|
||||||
|
$('.js-updatenotice').prop('state', 'ready-to-install');
|
||||||
|
$('.js-updatenotice').data('file', state.file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.js-updatenotice', (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
if ($('.js-updatenotice').prop('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('.js-updatenotice').prop('state') === 'ready-to-download') {
|
||||||
|
$('.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
|
||||||
|
|
||||||
|
|
||||||
ipcRenderer.on('fileList', (event, files) => {
|
ipcRenderer.on('fileList', (event, files) => {
|
||||||
firstRun = false;
|
firstRun = false;
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
@@ -92,12 +134,20 @@
|
|||||||
|
|
||||||
$(document).on('click', '.js-open-folder', (ev) => {
|
$(document).on('click', '.js-open-folder', (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
$('.js-open-folder-input').trigger('click');
|
|
||||||
|
dialog.showOpenDialog({
|
||||||
|
properties: ['openDirectory']
|
||||||
|
})
|
||||||
|
.then((path) => {
|
||||||
|
if (path && path.filePaths.length > 0) {
|
||||||
|
ipcRenderer.send('restart', path.filePaths[0]);
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('change', '.js-open-folder-input', (ev) => {
|
$(document).on('click', 'a[href^="http"]', function(event) {
|
||||||
ev.preventDefault();
|
event.preventDefault();
|
||||||
ipcRenderer.send('restart', $('.js-open-folder-input')[0].files[0].path);
|
shell.openExternal(this.href);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('keypress', (ev) => {
|
$(document).on('keypress', (ev) => {
|
||||||
|
57
app/main.js
57
app/main.js
@@ -3,6 +3,7 @@ const path = require('path');
|
|||||||
const url = require('url');
|
const url = require('url');
|
||||||
const electronLocalshortcut = require('electron-localshortcut');
|
const electronLocalshortcut = require('electron-localshortcut');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
|
const gau = require('github-app-updater');
|
||||||
const args = require('minimist')(process.defaultApp ? process.argv.slice(3) : process.argv.slice(1), {
|
const args = require('minimist')(process.defaultApp ? process.argv.slice(3) : process.argv.slice(1), {
|
||||||
default: {
|
default: {
|
||||||
_: process.cwd()
|
_: process.cwd()
|
||||||
@@ -13,7 +14,45 @@ let win;
|
|||||||
let repoDir = path.resolve(path.normalize(args._.join(' ')));
|
let repoDir = path.resolve(path.normalize(args._.join(' ')));
|
||||||
let repoRootDir = repoDir;
|
let repoRootDir = repoDir;
|
||||||
|
|
||||||
require('update-electron-app')();
|
//auto update stuff
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
setTimeout(() => {
|
||||||
|
gau.checkForUpdate({
|
||||||
|
currentVersion: app.getVersion(),
|
||||||
|
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,
|
||||||
|
asset: asset
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
gau.onNewVersionReadyToInstall = (file) => {
|
||||||
|
win.webContents.send('update', {
|
||||||
|
event: 'updateReadyToInstall',
|
||||||
|
file: file
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ipcMain.on('downloadUpdate', (event, asset) => {
|
||||||
|
gau.downloadNewVersion(asset);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('installUpdate', (event, file) => {
|
||||||
|
gau.executeUpdate(file);
|
||||||
|
win.webContents.send('update', {
|
||||||
|
event: 'updateInstalling'
|
||||||
|
});
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
//end update stuff
|
||||||
|
|
||||||
function getLfsFileList(dir, cb) {
|
function getLfsFileList(dir, cb) {
|
||||||
exec('git ls-files | git check-attr --stdin lockable', {
|
exec('git ls-files | git check-attr --stdin lockable', {
|
||||||
@@ -128,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.
|
||||||
@@ -225,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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
@@ -6,4 +6,7 @@
|
|||||||
<a class="btn btn-primary btn-lg js-open-folder" href="javascript:///">Open git repository folder</a>
|
<a class="btn btn-primary btn-lg js-open-folder" href="javascript:///">Open git repository folder</a>
|
||||||
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
|
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
|
||||||
</div>
|
</div>
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/S2-/gitlit">Homepage</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -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>
|
||||||
|
3312
package-lock.json
generated
3312
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlit",
|
"name": "gitlit",
|
||||||
"version": "1.5.1",
|
"version": "2.0.16",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app/main.js",
|
"main": "app/main.js",
|
||||||
"build": {
|
"build": {
|
||||||
@@ -27,28 +27,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"animate.css": "^3.5.2",
|
"animate.css": "^4.1.1",
|
||||||
"bootstrap": "^4.4.1",
|
"bootstrap": "^4.6.0",
|
||||||
"ejs": "^2.7.4",
|
"ejs": "^3.1.6",
|
||||||
"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",
|
||||||
"jquery": "^3.5.1",
|
"github-app-updater": "^1.0.5",
|
||||||
|
"jquery": "^3.6.0",
|
||||||
"material-design-icons": "^3.0.1",
|
"material-design-icons": "^3.0.1",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"nonblockjs": "^1.0.8",
|
"nonblockjs": "^1.0.8",
|
||||||
"pnotify": "^4.0.1",
|
"pnotify": "^4.0.1",
|
||||||
"popper.js": "^1.16.1",
|
"popper.js": "^1.16.1"
|
||||||
"update-electron-app": "^1.5.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^3.1.13",
|
"electron": "^13.1.2",
|
||||||
"electron-builder": "^20.44.4"
|
"electron-builder": "^22.11.7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"pack": "electron-builder --linux --win portable --dir",
|
"pack": "electron-builder --linux --win portable nsis --dir --publish=never",
|
||||||
"dist": "electron-builder --linux --win portable"
|
"dist": "electron-builder --linux --win portable nsis --publish=never"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Reference in New Issue
Block a user