mirror of
https://github.com/S2-/gitlit
synced 2025-08-02 20:30:05 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
cee594fcd9
|
|||
3c4d33eb83
|
|||
48b5f33eb9
|
|||
64b500f414
|
|||
caeaab14b8
|
|||
94e7c5ce71
|
|||
cdafb7a006
|
|||
6c2bc3397e
|
|||
a6666452d7
|
@@ -45,6 +45,9 @@ npm install
|
||||
npm run dist
|
||||
```
|
||||
|
||||
## notes
|
||||
Since version 2.0.1 the app auto updates itself.
|
||||
|
||||
## license
|
||||
|
||||
ISC
|
||||
|
@@ -49,3 +49,13 @@ table.sortable thead {
|
||||
table.sortable .sorttable_nosort {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* updater
|
||||
*/
|
||||
.updatenotice {
|
||||
position: fixed;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
|
@@ -20,8 +20,9 @@
|
||||
<link href="css/app.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="js-container">
|
||||
</div>
|
||||
<div class="js-container"></div>
|
||||
<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>
|
||||
</html>
|
||||
|
@@ -7,6 +7,35 @@
|
||||
let firstRun = true;
|
||||
|
||||
//events
|
||||
|
||||
//update stuff
|
||||
ipcRenderer.on('update', (event, state) => {
|
||||
if (state.event === 'updateAvailable') {
|
||||
$('.js-updatenotice').text(`New version ${state.version} available. Downloading...`);
|
||||
$('.js-updatenotice').prop('disabled', true);
|
||||
$('.js-updatenotice').show();
|
||||
}
|
||||
|
||||
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').data('file', state.file);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.js-updatenotice', (ev) => {
|
||||
ev.preventDefault();
|
||||
if ($('.js-updatenotice').prop('disabled')) {
|
||||
return;
|
||||
}
|
||||
$('.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) => {
|
||||
firstRun = false;
|
||||
if (files && files.length > 0) {
|
||||
|
34
app/main.js
34
app/main.js
@@ -3,6 +3,7 @@ const path = require('path');
|
||||
const url = require('url');
|
||||
const electronLocalshortcut = require('electron-localshortcut');
|
||||
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), {
|
||||
default: {
|
||||
_: process.cwd()
|
||||
@@ -13,7 +14,38 @@ let win;
|
||||
let repoDir = path.resolve(path.normalize(args._.join(' ')));
|
||||
let repoRootDir = repoDir;
|
||||
|
||||
require('update-electron-app')();
|
||||
//auto update stuff
|
||||
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
|
||||
});
|
||||
gau.downloadNewVersion(asset);
|
||||
};
|
||||
|
||||
gau.onNewVersionReadyToInstall = (file) => {
|
||||
win.webContents.send('update', {
|
||||
event: 'updateReadyToInstall',
|
||||
file: file
|
||||
});
|
||||
};
|
||||
|
||||
ipcMain.on('installUpdate', (event, file) => {
|
||||
gau.executeUpdate(file);
|
||||
win.webContents.send('update', {
|
||||
event: 'updateInstalling'
|
||||
});
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
//end update stuff
|
||||
|
||||
function getLfsFileList(dir, cb) {
|
||||
exec('git ls-files | git check-attr --stdin lockable', {
|
||||
|
52
package-lock.json
generated
52
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitlit",
|
||||
"version": "1.5.2",
|
||||
"version": "2.0.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -264,9 +264,9 @@
|
||||
}
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
|
||||
"integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.5.0.tgz",
|
||||
"integrity": "sha512-Z93QoXvodoVslA+PWNdk23Hze4RBYIkpb5h8I2HY2Tu2h7A0LpAgLcyrhrSUyo2/Oxm2l1fRZPs1e5hnxnliXA=="
|
||||
},
|
||||
"boxen": {
|
||||
"version": "3.2.0",
|
||||
@@ -871,11 +871,6 @@
|
||||
"resolved": "https://registry.npmjs.org/electron-is-accelerator/-/electron-is-accelerator-0.1.2.tgz",
|
||||
"integrity": "sha1-UJ5RDCala1Xhf4Y6SwThEYRqsns="
|
||||
},
|
||||
"electron-is-dev": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-0.3.0.tgz",
|
||||
"integrity": "sha1-FOb9pcaOnk7L7/nM8DfL18BcWv4="
|
||||
},
|
||||
"electron-localshortcut": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-localshortcut/-/electron-localshortcut-3.2.1.tgz",
|
||||
@@ -1170,12 +1165,20 @@
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"github-url-to-object": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/github-url-to-object/-/github-url-to-object-4.0.4.tgz",
|
||||
"integrity": "sha512-1Ri1pR8XTfzLpbtPz5MlW/amGNdNReuExPsbF9rxLsBfO1GH9RtDBamhJikd0knMWq3RTTQDbTtw0GGvvEAJEA==",
|
||||
"github-app-updater": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/github-app-updater/-/github-app-updater-1.0.1.tgz",
|
||||
"integrity": "sha512-gQ+DngMWmBRTP5wI6uuy2+m0ROfMphdUsrchN4kSmEc+9uAM67/xf7hluCnUL0dbrLaX7nxJ3VTTm7rZnQliOA==",
|
||||
"requires": {
|
||||
"is-url": "^1.1.0"
|
||||
"node-fetch": "^2.6.0",
|
||||
"semver": "^7.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
|
||||
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"global-dirs": {
|
||||
@@ -1389,11 +1392,6 @@
|
||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
|
||||
"dev": true
|
||||
},
|
||||
"is-url": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",
|
||||
"integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww=="
|
||||
},
|
||||
"is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
@@ -1689,6 +1687,11 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
||||
},
|
||||
"nonblockjs": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/nonblockjs/-/nonblockjs-1.0.8.tgz",
|
||||
@@ -2576,17 +2579,6 @@
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"dev": true
|
||||
},
|
||||
"update-electron-app": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/update-electron-app/-/update-electron-app-1.5.0.tgz",
|
||||
"integrity": "sha512-g7noW9JfQ8Hwq6zw9lmZei+R/ikOIBcaZ04TbmIcU5zNfv23HkN80QLLAyiR/47KvfS4sjnh2/wuDq5nh8+0mQ==",
|
||||
"requires": {
|
||||
"electron-is-dev": "^0.3.0",
|
||||
"github-url-to-object": "^4.0.4",
|
||||
"is-url": "^1.2.4",
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"update-notifier": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz",
|
||||
|
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitlit",
|
||||
"version": "1.5.2",
|
||||
"version": "2.0.2",
|
||||
"description": "",
|
||||
"main": "app/main.js",
|
||||
"build": {
|
||||
@@ -28,18 +28,18 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"animate.css": "^3.5.2",
|
||||
"bootstrap": "^4.4.1",
|
||||
"bootstrap": "^4.5.0",
|
||||
"ejs": "^2.7.4",
|
||||
"ejs-render-remote": "^1.0.13",
|
||||
"electron-find": "^1.0.6",
|
||||
"electron-localshortcut": "^3.2.1",
|
||||
"github-app-updater": "^1.0.1",
|
||||
"jquery": "^3.5.1",
|
||||
"material-design-icons": "^3.0.1",
|
||||
"minimist": "^1.2.5",
|
||||
"nonblockjs": "^1.0.8",
|
||||
"pnotify": "^4.0.1",
|
||||
"popper.js": "^1.16.1",
|
||||
"update-electron-app": "^1.5.0"
|
||||
"popper.js": "^1.16.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^3.1.13",
|
||||
@@ -47,8 +47,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"pack": "electron-builder --linux --win portable nsis --dir",
|
||||
"dist": "electron-builder --linux --win portable nsis"
|
||||
"pack": "electron-builder --linux --win portable nsis --dir --publish=never",
|
||||
"dist": "electron-builder --linux --win portable nsis --publish=never"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Reference in New Issue
Block a user