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

46 Commits

Author SHA1 Message Date
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
17 changed files with 2096 additions and 2414 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"]
}
}

3
.gitignore vendored
View File

@@ -1,3 +1,2 @@
node_modules
app/node_modules
dist
node_modules

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
}

16
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron Main",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
//"program": "${workspaceFolder}/app/main.js",
"args": ["${workspaceFolder}/app/main.js", "C:\\Temp\\test"]
}
]
}

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

View File

@@ -1,4 +1,4 @@
# gitlit
# ![gitlit](build/icon.png)
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,32 @@ gitlit /home/s2/myApp
```
If no folder is specified, gitlit looks at the current path.
## 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
```
cd app
npm install
npm start
```
### make a release
```
npm install
npm run dist
```
## license
ISC

View File

@@ -7,17 +7,17 @@
<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="js/templates.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>

View File

@@ -1,10 +1,8 @@
(function($) {
const ipcRenderer = require('electron').ipcRenderer;
const searchInPage = require('electron-in-page-search').default;
const remote = require('electron').remote;
const inPageSearch = searchInPage(remote.getCurrentWebContents());
const electronFind = require('electron-find');
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
//events
ipcRenderer.on('fileList', (event, files) => {
@@ -45,16 +43,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);
}
});
@@ -78,11 +78,12 @@
$(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);
}
});

View File

@@ -3,16 +3,18 @@ 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 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 repoRootDir = repoDir;
function getLfsFileList(dir, cb) {
exec('git lfs ls-files', {
exec('git ls-files | git check-attr --stdin lockable', {
maxBuffer: 1024 * 1024,
cwd: dir
},
(error, stdout, stderr) => {
@@ -25,9 +27,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 +46,7 @@ function getLfsFileList(dir, cb) {
function getLfsLocks(dir, cb) {
exec('git lfs locks', {
maxBuffer: 1024 * 1024,
cwd: dir
},
(error, stdout, stderr) => {
@@ -53,7 +60,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({
@@ -91,7 +98,7 @@ function createWindow() {
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
}));
electronLocalshortcut.register(win, 'F12', () => {
win.webContents.toggleDevTools();
@@ -115,12 +122,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);
@@ -134,11 +142,12 @@ function createWindow() {
ipcMain.on('unlock', (event, file) => {
exec('git lfs unlock "' + file + '"', {
maxBuffer: 1024 * 1024,
cwd: repoDir
},
(error, stdout, stderr) => {
let notification = {
message: (error && error.message) || stderr,
message: (error && error.message) || stderr,
type: 'error'
};
@@ -156,11 +165,12 @@ ipcMain.on('unlock', (event, file) => {
ipcMain.on('lock', (event, file) => {
exec('git lfs lock --json "' + file + '"', {
maxBuffer: 1024 * 1024,
cwd: repoDir
},
(error, stdout, stderr) => {
let notification = {
message: (error && error.message) || stderr,
message: (error && error.message) || stderr,
type: 'error'
};
@@ -177,7 +187,23 @@ ipcMain.on('lock', (event, file) => {
});
});
app.on('ready', createWindow);
app.on('ready', () => {
exec('git rev-parse --show-toplevel', {
maxBuffer: 1024 * 1024,
cwd: repoDir
},
(error, stdout, stderr) => {
if (error) {
console.error(error);
}
if (stdout) {
repoRootDir = path.normalize(stdout.replace(/\n/g, ''));
}
createWindow();
});
});
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {

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"
}

BIN
build/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 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 ..

2818
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,57 @@
{
"name": "gitlit",
"version": "1.0.0",
"version": "1.1.0",
"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": "^3.5.2",
"bootstrap": "^4.1.3",
"ejs": "^2.6.1",
"electron-find": "^1.0.6",
"electron-localshortcut": "^3.1.0",
"jquery": "^3.3.1",
"material-design-icons": "^3.0.1",
"minimist": "^1.2.0",
"nonblockjs": "^1.0.8",
"pnotify": "^4.0.0-alpha.4",
"popper.js": "^1.14.3"
},
"devDependencies": {
"electron": "^3.0.3",
"electron-builder": "^20.43.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "electron .",
"pack": "electron-builder --linux --win --dir",
"dist": "electron-builder --linux --win"
},
"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"
}