mirror of
https://github.com/S2-/gitlit
synced 2025-08-03 04:40:05 +02:00
!
This commit is contained in:
78
.jscsrc
Normal file
78
.jscsrc
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
@@ -14,9 +14,8 @@
|
|||||||
<link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
|
<link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="alert alert-primary" role="alert">
|
||||||
<script>
|
Getting file list...
|
||||||
$('body').html(gitlit.templates.main());
|
</div>
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
require('electron').ipcRenderer.on('ping', (event, message) => {
|
let ipcRenderer = require('electron').ipcRenderer;
|
||||||
console.log(message) // Prints 'whoooooooh!'
|
ipcRenderer.on('fileList', (event, files) => {
|
||||||
})
|
$('body').html(gitlit.templates.main({files: files}));
|
||||||
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@@ -1,17 +1,26 @@
|
|||||||
window.gitlit = window.gitlit || {};
|
window.gitlit = window.gitlit || {};
|
||||||
gitlit.templates = {
|
gitlit.templates = {
|
||||||
main: ejs.compile(`
|
main: ejs.compile(`
|
||||||
<table class="table table-striped">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>file</th>
|
<th>file</th>
|
||||||
<th>status</th>
|
<th>status</th>
|
||||||
<th>action</th>
|
<th>action</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>ciccio.txt</td>
|
<% files.forEach((file) => { %>
|
||||||
<td>locked</td>
|
<tr class="<%= file.lockedBy ? 'alert alert-danger' : '' %>">
|
||||||
<td></td>
|
<td><%= file.file %></td>
|
||||||
|
<td><%= file.lockedBy ? file.lockedBy + ' (id: ' + file.id + ')' : 'not locked' %></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-<%= file.lockedBy ? 'danger' : 'primary' %>"
|
||||||
|
href="javascript:///">
|
||||||
|
<%= file.lockedBy ? 'Unlock' : 'Lock' %>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% }); %>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
`)
|
`)
|
||||||
};
|
};
|
||||||
|
92
app/main.js
92
app/main.js
@@ -2,9 +2,79 @@ const {app, BrowserWindow} = require('electron');
|
|||||||
const path = require('path');
|
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 args = require('minimist')(process.argv.slice(2), {
|
||||||
|
default: {
|
||||||
|
_: process.cwd()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function createWindow () {
|
function getLfsFileList(dir, cb) {
|
||||||
|
exec('git lfs ls-files', {
|
||||||
|
cwd: dir
|
||||||
|
},
|
||||||
|
(error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
cb(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (stdout) {
|
||||||
|
let files = stdout.split('\n');
|
||||||
|
let parsedFiles = [];
|
||||||
|
files.forEach((file) => {
|
||||||
|
file = file.split(' * ');
|
||||||
|
if (file[1]) {
|
||||||
|
parsedFiles.push(file[1].trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cb(null, parsedFiles);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function getLfsLocks(dir, cb) {
|
||||||
|
exec('git lfs locks', {
|
||||||
|
cwd: dir
|
||||||
|
},
|
||||||
|
(error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
cb(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (stdout) {
|
||||||
|
let files = stdout.split('\n');
|
||||||
|
let parsedFiles = [];
|
||||||
|
files.forEach((file) => {
|
||||||
|
if (file) {
|
||||||
|
let fileName = file.split('\t')[0].trim();
|
||||||
|
let lockedBy = file.split('\t')[1].trim();
|
||||||
|
let id = file.split('ID:')[1].trim();
|
||||||
|
parsedFiles.push({
|
||||||
|
file: fileName,
|
||||||
|
lockedBy: lockedBy,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cb(null, parsedFiles);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function getArrayObjectByKey(array, key, value, defaultKeyValue) {
|
||||||
|
let o = array.filter((e) => {
|
||||||
|
return e[key] === value;
|
||||||
|
});
|
||||||
|
if (o.length > 0) {
|
||||||
|
return defaultKeyValue ? o[0][defaultKeyValue] : o[0];
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
win = new BrowserWindow({width: 800, height: 600});
|
win = new BrowserWindow({width: 800, height: 600});
|
||||||
win.setMenu(null);
|
win.setMenu(null);
|
||||||
@@ -21,7 +91,25 @@ function createWindow () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', () => {
|
win.webContents.on('did-finish-load', () => {
|
||||||
win.webContents.send('ping', 'whoooooooh!')
|
console.log('getting file list and lock status...');
|
||||||
|
|
||||||
|
getLfsFileList(args._.join(' '), (err, files) => {
|
||||||
|
getLfsLocks(args._.join(' '), (err, lockedFiles) => {
|
||||||
|
let allFiles = [];
|
||||||
|
|
||||||
|
files.forEach((file) => {
|
||||||
|
const t = {
|
||||||
|
file: file,
|
||||||
|
lockedBy: getArrayObjectByKey(lockedFiles, 'file', file, 'lockedBy'),
|
||||||
|
id: getArrayObjectByKey(lockedFiles, 'file', file, 'id')
|
||||||
|
};
|
||||||
|
|
||||||
|
allFiles.push(t);
|
||||||
|
});
|
||||||
|
|
||||||
|
win.webContents.send('fileList', allFiles);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
app/node_modules/minimist/package.json
generated
vendored
16
app/node_modules/minimist/package.json
generated
vendored
@@ -1,21 +1,23 @@
|
|||||||
{
|
{
|
||||||
"_from": "minimist@^1.2.0",
|
"_from": "minimist",
|
||||||
"_id": "minimist@1.2.0",
|
"_id": "minimist@1.2.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
"_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||||
"_location": "/minimist",
|
"_location": "/minimist",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "range",
|
"type": "tag",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "minimist@^1.2.0",
|
"raw": "minimist",
|
||||||
"name": "minimist",
|
"name": "minimist",
|
||||||
"escapedName": "minimist",
|
"escapedName": "minimist",
|
||||||
"rawSpec": "^1.2.0",
|
"rawSpec": "",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "^1.2.0"
|
"fetchSpec": "latest"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/",
|
||||||
"/electron-download",
|
"/electron-download",
|
||||||
"/meow",
|
"/meow",
|
||||||
"/nugget",
|
"/nugget",
|
||||||
@@ -23,8 +25,8 @@
|
|||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||||
"_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
|
"_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
|
||||||
"_spec": "minimist@^1.2.0",
|
"_spec": "minimist",
|
||||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-download",
|
"_where": "E:\\projects\\p\\gitlit\\app",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "James Halliday",
|
"name": "James Halliday",
|
||||||
"email": "mail@substack.net",
|
"email": "mail@substack.net",
|
||||||
|
3
app/package-lock.json
generated
3
app/package-lock.json
generated
@@ -761,8 +761,7 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
|
@@ -7,7 +7,8 @@
|
|||||||
"bootstrap": "^4.1.1",
|
"bootstrap": "^4.1.1",
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
"electron-localshortcut": "^3.1.0",
|
"electron-localshortcut": "^3.1.0",
|
||||||
"jquery": "^3.3.1"
|
"jquery": "^3.3.1",
|
||||||
|
"minimist": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^2.0.1"
|
"electron": "^2.0.1"
|
||||||
|
Reference in New Issue
Block a user