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

8 Commits

Author SHA1 Message Date
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
10 changed files with 89 additions and 75 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
dist dist
node_modules node_modules
.vscode

16
.vscode/launch.json vendored
View File

@@ -1,16 +0,0 @@
{
// 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"]
}
]
}

View File

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

View File

@@ -1,4 +1,4 @@
# ![gitlit](build/icon.png) # <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). 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).
@@ -33,7 +33,6 @@ There are just some js libraries:
### run the app ### run the app
``` ```
cd app
npm install npm install
npm start npm start
``` ```

View File

@@ -9,7 +9,7 @@
if (files && files.length > 0) { if (files && files.length > 0) {
$('.files-table-container').html(gitlit.templates.files({files: files})); $('.files-table-container').html(gitlit.templates.files({files: files}));
sorttable.makeSortable($('.js-filestable')[0]); sorttable.makeSortable($('.js-filestable')[0]);
var myTH = document.getElementsByTagName("th")[0]; var myTH = document.getElementsByTagName('th')[0];
sorttable.innerSortFunction.apply(myTH, []); sorttable.innerSortFunction.apply(myTH, []);
} else { } else {
$('.files-table-container').html(gitlit.templates.noGitLfsFiles()); $('.files-table-container').html(gitlit.templates.noGitLfsFiles());
@@ -17,6 +17,7 @@
}); });
ipcRenderer.on('repoDir', (event, repoDir) => { ipcRenderer.on('repoDir', (event, repoDir) => {
$('.js-container').html(gitlit.templates.main());
$('.js-repo-dir').text('current repo dir: ' + repoDir).show(); $('.js-repo-dir').text('current repo dir: ' + repoDir).show();
}); });
@@ -87,8 +88,21 @@
} }
}); });
$(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 //startup
PNotify.defaults.styling = 'bootstrap4'; // Bootstrap version 4 PNotify.defaults.styling = 'bootstrap4'; // Bootstrap version 4
$('.js-container').html(gitlit.templates.main());
})(jQuery); })(jQuery);

View File

@@ -9,7 +9,8 @@ const args = require('minimist')(process.defaultApp ? process.argv.slice(3) : pr
} }
}); });
const repoDir = path.resolve(path.normalize(args._.join(' '))); let win;
let repoDir = path.resolve(path.normalize(args._.join(' ')));
let repoRootDir = repoDir; let repoRootDir = repoDir;
function getLfsFileList(dir, cb) { function getLfsFileList(dir, cb) {
@@ -86,25 +87,9 @@ function getArrayObjectByKey(array, key, value, defaultKeyValue) {
return defaultKeyValue ? o[0][defaultKeyValue] : o[0]; return defaultKeyValue ? o[0][defaultKeyValue] : o[0];
} }
return undefined; return undefined;
} };
function createWindow() { function loadRepoPage() {
// 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', () => {
win.webContents.send('repoDir', repoDir); win.webContents.send('repoDir', repoDir);
getLfsFileList(repoDir, (err, files) => { getLfsFileList(repoDir, (err, files) => {
@@ -137,8 +122,51 @@ function createWindow() {
win.webContents.send('fileList', allFiles); win.webContents.send('fileList', allFiles);
}); });
}); });
};
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', () => {
loadRepoPage();
});
};
function startup(cb) {
exec('git rev-parse --show-toplevel', {
maxBuffer: 1024 * 1024,
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) => { ipcMain.on('unlock', (event, file) => {
exec('git lfs unlock "' + file + '"', { exec('git lfs unlock "' + file + '"', {
@@ -187,22 +215,13 @@ ipcMain.on('lock', (event, file) => {
}); });
}); });
ipcMain.on('restart', (event, newRepoDir) => {
repoDir = newRepoDir;
startup(loadRepoPage);
});
app.on('ready', () => { app.on('ready', () => {
exec('git rev-parse --show-toplevel', { startup(createWindow);
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() { app.on('window-all-closed', function() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 10 KiB

BIN
logo/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "gitlit", "name": "gitlit",
"version": "1.1.0", "version": "1.2.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "gitlit", "name": "gitlit",
"version": "1.1.0", "version": "1.2.0",
"description": "", "description": "",
"main": "app/main.js", "main": "app/main.js",
"build": { "build": {