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

118 Commits

Author SHA1 Message Date
dependabot[bot]
0fa715247d Bump http-cache-semantics from 4.1.0 to 4.1.1
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-03 04:54:17 +00:00
s2
44b4183597 2.0.16 2021-06-19 00:44:18 +02:00
s2
cfce0edaa9 update node modules 2021-06-19 00:43:58 +02:00
s2
5edd143318 2.0.15 2021-05-07 15:54:10 +02:00
s2
e576161518 update node modules 2021-05-07 15:53:54 +02:00
s2
7a63056ef3 2.0.14 2021-01-29 09:43:45 +01:00
s2
efd9d13454 update node modules 2021-01-29 09:43:28 +01:00
s2
9836f5c918 2.0.13 2021-01-13 15:57:32 +01:00
s2
6c9787fea1 add homepage link 2021-01-13 15:57:21 +01:00
s2
16138409f9 2.0.12 2020-12-11 12:34:12 +01:00
s2
f604749ce8 update electron 2020-12-11 12:33:55 +01:00
s2
a259bd3e14 2.0.11 2020-10-16 12:01:12 +02:00
s2
e3ed1c6e44 update node modules 2020-10-16 12:00:49 +02:00
s2
5d60c8baac 2.0.10 2020-09-13 12:53:00 +02:00
s2
8afc7fdac1 update node modules 2020-09-13 12:52:30 +02:00
s2
e934617a03 ask if the update should be downloaded 2020-09-13 12:52:22 +02:00
s2
9f696e12f9 2.0.9 2020-09-13 10:24:36 +02:00
s2
b326c45593 update node modules 2020-09-13 10:24:23 +02:00
s2
c905040f0e 2.0.8 2020-07-21 14:29:51 +02:00
s2
a171760bd6 update npm modules 2020-07-21 14:29:38 +02:00
s2
ce50a38e35 2.0.7 2020-07-07 11:50:30 +02:00
s2
133f72df2a fix updater 2020-07-07 11:50:21 +02:00
s2
bebaf95f70 2.0.6 2020-07-07 10:42:56 +02:00
s2
e719261427 update to latest electron version 2020-07-07 10:40:27 +02:00
s2
1fe4d0d90c 2.0.5 2020-06-07 22:43:44 +02:00
s2
9873246826 auto update only on windows 2020-06-07 22:43:33 +02:00
s2
b8a94f650f 2.0.4 2020-06-07 22:17:29 +02:00
s2
e97a5c1fc2 just readme 2020-06-07 22:17:26 +02:00
s2
3d020a3ddd 2.0.3 2020-06-07 20:22:57 +02:00
s2
8765f99f19 update node modules 2020-06-07 20:22:50 +02:00
s2
cee594fcd9 2.0.2 2020-06-07 20:16:05 +02:00
s2
3c4d33eb83 just a note 2020-06-07 20:15:56 +02:00
s2
48b5f33eb9 2.0.1 2020-06-07 20:04:45 +02:00
s2
64b500f414 update node modules 2020-06-07 20:04:45 +02:00
s2
caeaab14b8 remove console.log 2020-06-07 19:50:00 +02:00
s2
94e7c5ce71 don't publish by default in electron builder 2020-06-07 19:48:06 +02:00
s2
cdafb7a006 2.0.0 2020-06-07 19:38:18 +02:00
s2
6c2bc3397e auto update app 2020-06-07 19:37:56 +02:00
s2
a6666452d7 remove update-electron-app 2020-06-07 17:48:58 +02:00
s2
e9feebce51 1.5.2 2020-05-09 15:48:10 +02:00
s2
510e4786b7 create installer package 2020-05-09 15:45:01 +02:00
s2
b540eae1b9 1.5.1 2020-05-09 12:22:28 +02:00
s2
8f3705ba74 show gitlit version in window title 2020-05-09 12:22:21 +02:00
s2
e032eb2ab0 1.5.0 2020-05-09 12:10:34 +02:00
s2
519d719545 auto updater 2020-05-09 12:10:25 +02:00
s2
f8076499ba build windows portable binary 2020-05-09 12:09:23 +02:00
s2
edeadfd7fc 1.4.4 2020-05-06 20:23:03 +02:00
s2
9c26b8fb10 bump exec maxBuffer size to 10MB 2020-05-06 20:22:47 +02:00
s2
b0f3ba27b5 1.4.3 2020-05-06 20:08:09 +02:00
s2
99c858e5a7 update npm modules 2020-05-06 20:08:04 +02:00
s2
9f02f5f27c 1.4.2 2020-03-16 21:46:57 +01:00
s2
48ecb505d7 update node modules 2020-03-16 21:46:15 +01:00
s2
a04c84abb4 1.4.1 2019-06-21 14:15:57 +02:00
s2
31c19d5534 make jumbotron nicer 2019-06-21 09:31:36 +02:00
s2
171b79e355 1.4.0 2019-06-20 15:52:56 +02:00
s2
4178caa94a show splash screen on startup if passed path is not a git repo 2019-06-20 15:51:56 +02:00
s2
7cae3f33ec 1.3.1 2019-06-20 15:15:46 +02:00
s2
3952948a15 fix sortable 2019-06-20 15:14:33 +02:00
s2
011a78a75f style fixes 2019-06-20 15:14:33 +02:00
s2
e0ad69a5b1 remove old templates 2019-06-20 15:14:33 +02:00
s2
e994b98dcc show open an other folder button if there are no tracked files 2019-06-20 10:59:46 +02:00
s2
6431183092 1.3.0 2019-06-20 10:32:04 +02:00
s2
28acea0c74 ejs.rr & open folder button 2019-06-20 10:17:28 +02:00
s2
f69e80e306 add d&d instructions to readme 2019-06-19 15:44:20 +02:00
s2
81fd51656e 1.2.0 2019-06-19 10:07:49 +02:00
s2
b54fb104be add folder drag&drop functionality 2019-06-19 10:07:39 +02:00
s2
1072c27e6d remove ide files from repo 2019-06-17 21:02:02 +02:00
s2
ead56bac77 readme fix 2019-06-17 20:54:45 +02:00
s2
4eef037145 1.1.1 2019-06-17 20:37:09 +02:00
s2
2be62645d9 change icon colors 2019-06-17 20:36:47 +02:00
s2
5abd0d6f27 logo size 2019-06-17 20:26:31 +02:00
s2
8fb44bc439 make image nicer in readme 2019-06-17 20:20:37 +02:00
s2
42c754d5c2 1.1.0 2019-06-17 20:14:08 +02:00
s2
4d28e8495d add icon 2019-06-17 20:13:59 +02:00
s2
28662aa961 minor readme fix 2019-06-17 20:01:33 +02:00
s2
67be0c888e build for win and linux 2019-06-17 17:57:18 +02:00
s2
769ea1ce73 switch to electron-builder 2019-06-17 17:35:36 +02:00
s2
5fef5c7236 1.0.9 2019-06-17 15:34:52 +02:00
s2
81e88046d2 add some keywords 2019-06-17 15:33:27 +02:00
s2
c577446cc5 change git repo url 2019-06-17 15:32:51 +02:00
s2
b841785adb 1.0.8 2019-06-12 15:53:41 +02:00
s2
9eae13612e fix lock/unlock refresh 2019-06-12 15:52:58 +02:00
s2
36f71da17a 1.0.7 2019-06-12 11:21:52 +02:00
s2
e0f88f12e1 fix show locks when in a subfolder 2019-06-12 11:21:15 +02:00
s2
c7dab12990 1.0.6 2019-06-07 12:40:17 +02:00
s2
9b0377efc9 show all lockable files 2019-06-07 12:37:30 +02:00
s2
029712a32b 1.0.5 2019-06-06 17:07:23 +02:00
s2
1718c7652e fix args 2019-06-06 17:06:25 +02:00
s2
1313cff86a fix search window 2019-06-06 15:56:42 +02:00
s2
c5f9b551ab remove electron-in-page-search 2019-06-06 15:44:24 +02:00
s2
e2a57318a7 fix args in dev? 2019-06-06 15:42:22 +02:00
s2
17bb850527 debug 2019-06-06 15:40:02 +02:00
s2
3111f2b327 remova package-lock 2019-03-09 16:40:05 +01:00
s2
d24a82e91e update some packages and remove node_modules from repo 2019-03-09 16:38:37 +01:00
s2
3dcadb39c2 remove circleci stuff 2018-12-18 15:47:16 +01:00
s2
dfa91111a6 sudo! 2018-12-12 17:29:13 +01:00
s2
51a6fd153f apt-get install software-properties-common 2018-12-12 17:28:30 +01:00
s2
6d71042f69 install wine 2018-12-12 17:25:03 +01:00
s2
cae59c6a72 store artifacts 2018-12-12 17:09:00 +01:00
s2
cf51498711 config.yml test 2018-12-12 17:04:46 +01:00
s2
c910dd25a5 v1.0.4 2018-12-12 15:25:39 +01:00
s2
066e46a202 better lfs ls-files separator handling 2018-12-12 15:25:30 +01:00
s2
325c4479cc update deps 2018-12-11 18:39:24 +01:00
s2
3c557f7ce5 v1.0.3 2018-12-11 18:22:11 +01:00
s2
613525752b incerase maxBuffer on exec 2018-12-11 18:10:01 +01:00
s2
ec1931ca52 version 1.0.2 2018-10-10 15:30:52 +02:00
s2
5c55c54b71 update dependencies 2018-10-10 15:11:12 +02:00
s2
da4083f574 update dependencies 2018-10-09 09:51:34 +02:00
s2
4fcc873901 increase version 2018-06-03 13:59:06 +02:00
s2
ae314d1d0a add dev instructions 2018-06-03 13:57:37 +02:00
s2
cb87d6a9cd ctrl + r for refresh 2018-06-03 13:57:37 +02:00
s2
d002126b72 add node modules to repo 2018-06-03 13:57:23 +02:00
s2
e8c95255e8 keep node modules 2018-06-03 13:46:58 +02:00
s2
dec767fe75 update package-lock 2018-05-22 08:39:40 +02:00
s2
2c5b23c10e packager 2018-05-22 08:34:57 +02:00
s2
0ea0853165 typo 2018-05-19 23:33:43 +02:00
s2
6227e2328b fix ejs link 2018-05-19 23:33:11 +02:00
s2
67add0f1de dev notes 2018-05-19 23:28:12 +02:00
24 changed files with 2841 additions and 3041 deletions

1
.eslintignore Normal file
View File

@@ -0,0 +1 @@
node_modules

33
.eslintrc.json Normal file
View File

@@ -0,0 +1,33 @@
{"parserOptions":
{"ecmaVersion": 6},
"rules": {
"quotes": [2, "single", {"allowTemplateLiterals": true}],
"curly": [2, "all"],
"keyword-spacing": [2, {"overrides": {"else": {"before": true}, "catch": {"before": true, "after": false}}}],
"space-before-blocks": [2, "always"],
"wrap-iife": [2, "inside"],
"space-before-function-paren": [2, "never"],
"one-var": [2, "never"],
"vars-on-top": 0, "no-empty": [2, {"allowEmptyCatch": true}],
"array-bracket-spacing": [2, "never"],
"space-in-parens": [2, "never"],
"no-underscore-dangle": 0,
"comma-style": [2, "last"],
"comma-spacing": [2, {"before": false, "after": true}],
"space-unary-ops": [2, {"words": false, "nonwords": false}],
"no-multi-spaces": 2,
"space-infix-ops": 2,
"no-with": 2,
"indent": [2, "tab", {"SwitchCase": 1, "FunctionExpression": {"body": 1, "parameters": 1}, "MemberExpression": 0}],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"comma-dangle": [2, "never"],
"semi": [2, "always"],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"eol-last": 2,
"dot-notation": 0,
"no-multi-str": 2,
"key-spacing": [2, {"afterColon": true}],
"func-call-spacing": [2, "never"]
}
}

4
.gitignore vendored
View File

@@ -1,3 +1,3 @@
node_modules
app/node_modules
dist
node_modules
.vscode

78
.jscsrc
View File

@@ -1,78 +0,0 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"return",
"try"
],
"requireSpaceBeforeKeywords": [
"else",
"catch"
],
"disallowSpaceAfterKeywords": [
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpaceBetweenArguments": true,
"disallowMultipleVarDecl": true,
"requireVarDeclFirst": false,
"requireBlocksOnNewline": false,
"disallowEmptyBlocks": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowDanglingUnderscores": false,
"requireCommaBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeBinaryOperators": [
","
],
"requireSpacesInForStatement": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"disallowKeywords": [
"with"
],
"validateIndentation": "\t",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"requireDotNotation": false,
"disallowNewlineBeforeBlockStatements": true,
"disallowMultipleLineStrings": true,
"requireSpaceBeforeObjectValues": true
}

View File

@@ -1,4 +1,4 @@
# gitlit
# <img src="logo/logo.png" alt="gitlit">
gitlit is a very simple desktop app that allows you to handle [git lfs file locks](https://github.com/git-lfs/git-lfs/wiki/File-Locking).
@@ -18,3 +18,36 @@ gitlit /home/s2/myApp
```
If no folder is specified, gitlit looks at the current path.
You can also drag&drop a folder inside the main window.
## contribute
The code is very easy. Just clone the repo and have look!
Use the `.eslintrc.json` for formatting the code and keep it clean and consistent.
There are just some js libraries:
- [ejs](http://ejs.co/) is used for templating. The templates are in `app/js/templates.js`.
- [sorttable.js](http://www.kryogenix.org/code/browser/sorttable/) to sort the table containing the files.
- [jQuery](https://jquery.com/), because it's still cool to have it, even if everyone says it's dead and we should do without.
- [Bootstrap](https://getbootstrap.com/) for the layout
- [PNotify](https://github.com/sciactive/pnotify) for generic notifications
### run the app
```
npm install
npm start
```
### make a release
```
npm install
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
ISC

View File

@@ -1,3 +1,12 @@
html {
margin-bottom: 10px;
}
.jumbotron {
height: 640px;
margin-bottom: 0px;
}
.js-container {
margin: 5px;
}
@@ -40,3 +49,13 @@ table.sortable thead {
table.sortable .sorttable_nosort {
cursor: default;
}
/*
* updater
*/
.updatenotice {
position: fixed;
bottom: 5px;
right: 5px;
}

View File

@@ -3,26 +3,26 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>gitlit</title>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../node_modules/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="node_modules/pnotify/dist/iife/PNotify.js"></script>
<script type="text/javascript" src="node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
<script type="text/javascript" src="../node_modules/pnotify/dist/iife/PNotify.js"></script>
<script type="text/javascript" src="../node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
<script src="node_modules/ejs/ejs.js"></script>
<script src="js/templates.js"></script>
<script src="js/sorttable.js"></script>
<script type="text/javascript" src="../node_modules/ejs/ejs.js"></script>
<script type="text/javascript" src="../node_modules/ejs-render-remote/ejs-render-remote.js"></script>
<script type="text/javascript" src="js/sorttable.js"></script>
<link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<link href="../node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<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>

View File

@@ -1,29 +1,84 @@
(function($) {
const ipcRenderer = require('electron').ipcRenderer;
const searchInPage = require('electron-in-page-search').default;
const remote = require('electron').remote;
const electronFind = require('electron-find');
const dialog = remote.require('electron').dialog;
const shell = require('electron').shell;
const inPageSearch = searchInPage(remote.getCurrentWebContents());
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
let firstRun = true;
//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) => {
firstRun = false;
if (files && files.length > 0) {
$('.files-table-container').html(gitlit.templates.files({files: files}));
ejs.preloadTemplate('templates/files.ejs')
.then(t => {
$('.files-table-container').html(ejs.rr(t, {files: files}));
sorttable.makeSortable($('.js-filestable')[0]);
var myTH = document.getElementsByTagName("th")[0];
var myTH = document.getElementsByTagName('th')[0];
sorttable.innerSortFunction.apply(myTH, []);
});
} else {
$('.files-table-container').html(gitlit.templates.noGitLfsFiles());
$('.files-table-container').html(ejs.rr('templates/noGitLfsFiles.ejs'));
}
});
ipcRenderer.on('repoDir', (event, repoDir) => {
ejs.preloadTemplate('templates/main.ejs')
.then(t => {
$('.js-container').html(ejs.rr(t));
$('.js-repo-dir').text('current repo dir: ' + repoDir).show();
});
});
ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => {
$('.js-container').html(gitlit.templates.isNoGitLfsRepo({repoDir: repoDir}));
if (firstRun) {
firstRun = false;
$('.js-container').html(ejs.rr('templates/firstRun.ejs', {repoDir: repoDir}));
} else {
$('.js-container').html(ejs.rr('templates/isNoGitLfsRepo.ejs', {repoDir: repoDir}));
}
});
ipcRenderer.on('notification', (event, notification) => {
@@ -45,16 +100,18 @@
}
if (notification.event && notification.event === 'unlock') {
$('[data-file="' + notification.file + '"].js-unlock').hide();
$('[data-file="' + notification.file + '"].js-lock').show();
let file = notification.file.replace(/\\/g, '\\\\');
$('[data-file="' + file + '"].js-unlock').hide();
$('[data-file="' + file + '"].js-lock').show();
let text = 'not locked';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
$('[data-file="' + file + '"]').parent().prev().text(text);
}
if (notification.event && notification.event === 'lock') {
$('[data-file="' + notification.file + '"].js-lock').hide();
$('[data-file="' + notification.file + '"].js-unlock').show();
let file = notification.file.replace(/\\/g, '\\\\');
$('[data-file="' + file + '"].js-lock').hide();
$('[data-file="' + file + '"].js-unlock').show();
let text = notification.data.owner.name + ' (id: ' + notification.data.id + ')';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
$('[data-file="' + file + '"]').parent().prev().text(text);
}
});
@@ -75,19 +132,51 @@
window.location.reload(false);
});
$(document).on('click', '.js-open-folder', (ev) => {
ev.preventDefault();
dialog.showOpenDialog({
properties: ['openDirectory']
})
.then((path) => {
if (path && path.filePaths.length > 0) {
ipcRenderer.send('restart', path.filePaths[0]);
};
});
});
$(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault();
shell.openExternal(this.href);
});
$(document).on('keypress', (ev) => {
//ctrl + f
if (ev.ctrlKey && ev.charCode == 6) {
if (inPageSearch && inPageSearch.opened) {
inPageSearch.closeSearchWindow();
} else {
inPageSearch.openSearchWindow();
findInPage.openFindWindow();
}
//ctrl + r
if (ev.ctrlKey && ev.keyCode == 18) {
window.location.reload(false);
}
});
$(document).on('drop', (ev) => {
ev.preventDefault();
ev.stopPropagation();
if (ev.originalEvent.dataTransfer.files && ev.originalEvent.dataTransfer.files.length > 0) {
ipcRenderer.send('restart', ev.originalEvent.dataTransfer.files[0].path);
}
});
$(document).on('dragover', (ev) => {
ev.preventDefault();
ev.stopPropagation();
});
//startup
PNotify.defaults.styling = 'bootstrap4'; // Bootstrap version 4
$('.js-container').html(gitlit.templates.main());
})(jQuery);

View File

@@ -1,63 +0,0 @@
window.gitlit = window.gitlit || {};
gitlit.templates = {
main: ejs.compile(`
<div class="alert alert-success js-repo-dir" style="display:none;"></div>
<div class="files-table-container">
<div class="alert alert-primary" role="alert">
Getting file list...
</div>
</div>
`),
files: ejs.compile(`
<table class="table table-striped sortable js-filestable">
<thead class="thead-light">
<tr>
<th>file</th>
<th>status</th>
<th class="sorttable_nosort">action</th>
</tr>
<thead>
<tbody>
<% files.forEach((file) => { %>
<tr>
<td><%= file.file %></td>
<td><%= file.lockedBy ? file.lockedBy + ' (id: ' + file.id + ')' : 'not locked' %></td>
<td>
<a class="btn btn-primary btn-sm js-lock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? 'display: none;' : '' %>"
>
Lock
</a>
<a class="btn btn-danger btn-sm js-unlock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? '' : 'display: none;' %>"
>
Unlock
</a>
</td>
</tr>
<% }); %>
</tbody>
</table>
<div class="float-right">
<a class="btn btn-secondary btn-sm js-refresh" href="javascript:///">
Refresh
</a>
</div>
`),
isNoGitLfsRepo: ejs.compile(`
<div class="alert alert-danger">
<%= repoDir %> is not a git lfs repo.
</div>
`),
noGitLfsFiles: ejs.compile(`
<div class="alert alert-info">
no files tracked with lfs here.
</div>
`)
};

View File

@@ -3,16 +3,60 @@ const path = require('path');
const url = require('url');
const electronLocalshortcut = require('electron-localshortcut');
const exec = require('child_process').exec;
const args = require('minimist')(process.defaultApp ? process.argv.slice(2) : process.argv.slice(1), {
const gau = require('github-app-updater');
const args = require('minimist')(process.defaultApp ? process.argv.slice(3) : process.argv.slice(1), {
default: {
_: process.cwd()
}
});
const repoDir = path.resolve(path.normalize(args._.join(' ')));
let win;
let repoDir = path.resolve(path.normalize(args._.join(' ')));
let repoRootDir = repoDir;
//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) {
exec('git lfs ls-files', {
exec('git ls-files | git check-attr --stdin lockable', {
maxBuffer: (1024 * 1024) * 10, //10MB
cwd: dir
},
(error, stdout, stderr) => {
@@ -25,9 +69,13 @@ function getLfsFileList(dir, cb) {
if (stdout) {
let files = stdout.split('\n');
files.forEach((file) => {
file = file.split(' * ');
if (file[1]) {
parsedFiles.push(file[1].trim());
let pos = file.split(': lockable: ');
if (pos && pos.length === 2) {
file = pos[0];
status = pos[1];
if (file && status === 'set') {
parsedFiles.push(path.normalize(file.trim()));
}
}
});
@@ -40,6 +88,7 @@ function getLfsFileList(dir, cb) {
function getLfsLocks(dir, cb) {
exec('git lfs locks', {
maxBuffer: (1024 * 1024) * 10, //10MB
cwd: dir
},
(error, stdout, stderr) => {
@@ -53,7 +102,7 @@ function getLfsLocks(dir, cb) {
let files = stdout.split('\n');
files.forEach((file) => {
if (file) {
let fileName = file.split('\t')[0].trim();
let fileName = path.normalize(file.split('\t')[0].trim());
let lockedBy = file.split('\t')[1].trim();
let id = file.split('ID:')[1].trim();
parsedFiles.push({
@@ -79,25 +128,9 @@ function getArrayObjectByKey(array, key, value, defaultKeyValue) {
return defaultKeyValue ? o[0][defaultKeyValue] : o[0];
}
return undefined;
}
};
function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600});
win.setMenu(null);
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
electronLocalshortcut.register(win, 'F12', () => {
win.webContents.toggleDevTools();
});
win.webContents.on('did-finish-load', () => {
function loadRepoPage() {
win.webContents.send('repoDir', repoDir);
getLfsFileList(repoDir, (err, files) => {
@@ -115,12 +148,13 @@ function createWindow() {
return;
}
let allFiles = [];
let repoDirWithoutRoot = repoDir === repoRootDir ? '' : repoDir.replace(path.normalize(repoRootDir + '/'), '');
files.forEach((file) => {
const t = {
file: file,
lockedBy: getArrayObjectByKey(lockedFiles, 'file', file, 'lockedBy'),
id: getArrayObjectByKey(lockedFiles, 'file', file, 'id')
lockedBy: getArrayObjectByKey(lockedFiles, 'file', path.normalize(repoDirWithoutRoot ? repoDirWithoutRoot + '/' + file : file), 'lockedBy'),
id: getArrayObjectByKey(lockedFiles, 'file', path.normalize(repoDirWithoutRoot ? repoDirWithoutRoot + '/' + file : file), 'id')
};
allFiles.push(t);
@@ -129,11 +163,63 @@ function createWindow() {
win.webContents.send('fileList', allFiles);
});
});
};
function createWindow() {
// Create the browser window.
win = new BrowserWindow({
title: 'gitlit v' + app.getVersion(),
width: 800,
height: 700,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
}
});
}
win.setMenu(null);
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
electronLocalshortcut.register(win, 'F12', () => {
win.webContents.toggleDevTools();
});
win.webContents.on('did-finish-load', () => {
loadRepoPage();
});
};
function startup(cb) {
exec('git rev-parse --show-toplevel', {
maxBuffer: (1024 * 1024) * 10, //10MB
cwd: repoDir
},
(error, stdout, stderr) => {
if (error) {
if (win) {
win.webContents.send('isNoGitLfsRepo', repoDir);
}
console.error(error);
}
if (stdout) {
repoRootDir = path.normalize(stdout.replace(/\n/g, ''));
}
if (cb) {
cb();
}
});
};
ipcMain.on('unlock', (event, file) => {
exec('git lfs unlock "' + file + '"', {
maxBuffer: (1024 * 1024) * 10, //10MB
cwd: repoDir
},
(error, stdout, stderr) => {
@@ -156,6 +242,7 @@ ipcMain.on('unlock', (event, file) => {
ipcMain.on('lock', (event, file) => {
exec('git lfs lock --json "' + file + '"', {
maxBuffer: (1024 * 1024) * 10, //10MB
cwd: repoDir
},
(error, stdout, stderr) => {
@@ -177,10 +264,11 @@ ipcMain.on('lock', (event, file) => {
});
});
app.on('ready', createWindow);
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
ipcMain.on('restart', (event, newRepoDir) => {
repoDir = newRepoDir;
startup(loadRepoPage);
});
app.on('ready', () => {
startup(createWindow);
});

1332
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
{
"name": "gitlit-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"dependencies": {
"bootstrap": "^4.1.1",
"ejs": "^2.6.1",
"electron-in-page-search": "^1.3.2",
"electron-localshortcut": "^3.1.0",
"jquery": "^3.3.1",
"minimist": "^1.2.0",
"pnotify": "^4.0.0-alpha.4",
"popper.js": "^1.14.3"
},
"devDependencies": {
"electron": "^2.0.1"
},
"scripts": {
"start": "electron ."
},
"repository": {
"type": "git",
"url": "https://git.e.tern.al/s2/gitlit"
},
"author": "",
"license": "ISC"
}

44
app/templates/files.ejs Normal file
View File

@@ -0,0 +1,44 @@
<table class="table table-striped sortable js-filestable">
<thead class="thead-light">
<tr>
<th>file</th>
<th>status</th>
<th class="sorttable_nosort">action</th>
</tr>
<thead>
<tbody>
<% files.forEach((file) => { %>
<tr>
<td><%= file.file %></td>
<td><%= file.lockedBy ? file.lockedBy + ' (id: ' + file.id + ')' : 'not locked' %></td>
<td>
<a class="btn btn-primary btn-sm js-lock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? 'display: none;' : '' %>"
>
Lock
</a>
<a class="btn btn-danger btn-sm js-unlock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? '' : 'display: none;' %>"
>
Unlock
</a>
</td>
</tr>
<% }); %>
</tbody>
</table>
<div class="float-right">
<div style="display: inline;">
<a class="btn btn-primary btn-sm js-open-folder" href="javascript:///">Open another folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div>
<a class="btn btn-secondary btn-sm js-refresh" href="javascript:///">
Refresh
</a>
</div>

View File

@@ -0,0 +1,12 @@
<div class="jumbotron text-center">
<img src="../logo/logo.png">
<h1>gitlit</h1>
<p class="lead">Handle git lfs locks with ease</p>
<div class="text-center">
<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 />
</div>
<p>
<a href="https://github.com/S2-/gitlit">Homepage</a>
</p>
</div>

View File

@@ -0,0 +1,4 @@
<div class="alert alert-danger">
<%= repoDir %> is not a git lfs repo.
</div>
<%- ejs.rr('templates/openFolder.ejs') %>

6
app/templates/main.ejs Normal file
View File

@@ -0,0 +1,6 @@
<div class="alert alert-success js-repo-dir" style="display:none;"></div>
<div class="files-table-container">
<div class="alert alert-primary" role="alert">
Getting file list...
</div>
</div>

View File

@@ -0,0 +1,4 @@
<div class="alert alert-info">
no files tracked with lfs here.
</div>
<%- ejs.rr('templates/openFolder.ejs') %>

View File

@@ -0,0 +1,3 @@
<div class="text-center">
<a class="btn btn-primary js-open-folder" href="javascript:///">Open another folder</a>
</div>

BIN
build/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
logo/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
logo/logo.xcf Normal file

Binary file not shown.

View File

@@ -1,15 +0,0 @@
#/bin/bash
rm -rf dist
mkdir dist
node_modules/.bin/electron-packager ./app/ gitlit --all --out dist/
cd dist
for d in *; do
if [[ -d "$d" ]]; then
tar czf "$d.tgz" "$d"
rm -rf "$d"
fi
done
cd ..

3753
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,59 @@
{
"name": "gitlit",
"version": "1.0.0",
"version": "2.0.16",
"description": "",
"main": "app/main.js",
"build": {
"appId": "s2.gitlit",
"linux": {
"target": [
{
"target": "tar.gz",
"arch": [
"x64"
]
}
]
},
"win": {
"target": [
{
"target": "zip",
"arch": [
"x64"
]
}
]
}
},
"dependencies": {
"animate.css": "^4.1.1",
"bootstrap": "^4.6.0",
"ejs": "^3.1.6",
"ejs-render-remote": "^1.0.13",
"electron-find": "^1.0.6",
"electron-localshortcut": "^3.2.1",
"github-app-updater": "^1.0.5",
"jquery": "^3.6.0",
"material-design-icons": "^3.0.1",
"minimist": "^1.2.5",
"nonblockjs": "^1.0.8",
"pnotify": "^4.0.1",
"popper.js": "^1.16.1"
},
"devDependencies": {
"electron": "^13.1.2",
"electron-builder": "^22.11.7"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "electron .",
"pack": "electron-builder --linux --win portable nsis --dir --publish=never",
"dist": "electron-builder --linux --win portable nsis --publish=never"
},
"repository": {
"type": "git",
"url": "ssh://git@git.e.tern.al:22022/s2/gitlit.git"
"url": "https://github.com/S2-/gitlit"
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron-packager": "^12.1.0"
}
"author": "s2",
"license": "ISC"
}