Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 0 additions & 17 deletions .gitattributes

This file was deleted.

Binary file modified .gitignore
Binary file not shown.
157 changes: 157 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-search');
grunt.loadNpmTasks('grunt-comment-toggler');

var packager = require('electron-packager');

const BUILD_DIR = 'build/';
const DIST_DIR = 'dist/';
const APP_NAME = 'APP Name';
const PLATFORM = 'all';
const ARCH = 'all';
const ELECTRON_VERSION = '1.2.3';
const USE_ASAR = true;

var toggleCommentsFiles = {files:{}};
toggleCommentsFiles.files[BUILD_DIR + 'index.html'] = 'index.html';

// Project configuration.
grunt.initConfig(
{
pkg: grunt.file.readJSON('package.json'),
uglify: {
production: {
files: [
{
src : 'scripts/**/*.js',
dest : BUILD_DIR + '/scripts/app.angular.min.js'
},
{
expand: true,
src: BUILD_DIR + 'main.js'
}
]
}
},
copy: {
electron_app: {
files: [
{
expand: true,
src: ['index.html', 'main.js', 'package.json'],
dest: BUILD_DIR
}
]
},
angular_app_html: {
files: [
{
expand: true,
src: ['scripts/**/*.html'],
dest: BUILD_DIR
}
]
}
},
search: {
node_modules_dependencies: {
files: {
src: ['index.html']
},
options: {
searchString: /="node_modules\/.*"/g,
logFormat: "custom",
onMatch: function (match) {
var filePath = match.match.substring(
2,
match.match.length - 1
);
grunt.file.copy(filePath, BUILD_DIR + filePath);
console.log('Found dependency: ' + filePath)
},
customLogFormatCallback: function (params) {
}
}
}
},
toggleComments: {
customOptions: {
padding: 1,
removeCommands: false
},
files: toggleCommentsFiles
}
}
);

grunt.registerTask(
'build',
[
'clean',
'copy:electron_app',
'copy:angular_app_html',
'toggleComments',
'search:node_modules_dependencies',
'uglify:production',
'package',
'fix_default_app'
]
);

// Clean the build directory
grunt.registerTask(
'clean',
function () {
if (grunt.file.isDir(BUILD_DIR)) {
grunt.file.delete(BUILD_DIR, {force: true});
}
}
);

grunt.registerTask(
'package',
function () {
var done = this.async();
packager(
{
dir: BUILD_DIR,
out: DIST_DIR,
name: APP_NAME,
platform: PLATFORM,
arch: ARCH,
version: ELECTRON_VERSION,
asar: USE_ASAR
},
function (err) {
if (err) {
grunt.warn(err);
return;
}

done();
}
);
}
);

// Used as a temporary fix for:
// https://github.com/maxogden/electron-packager/issues/49
grunt.registerTask(
'fix_default_app',
function () {

var default_apps = grunt.file.expand(
DIST_DIR + APP_NAME + '*/resources/default_app'
);

default_apps.forEach(
function (folder) {
console.log('Removing ' + folder);
grunt.file.delete(folder);
}
);
}
);
};
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FTP file manager built on Electron & Node

_There are still a few issues_

## Building & running it locally:
- Clone the repo.
- cd to the directory
- make sure electron is installed `npm install electron`
- install and run with `npm install && npm start`

## Packaging it (.app for mac, .exe for windows)
- Install [Electron Packager Interactive](https://github.com/Urucas/electron-packager-interactive) with `npm install -g electron-packager-interactive`
- run `epi`
- Follow steps
- Icon is `./icon.ico'
Binary file added app/.DS_Store
Binary file not shown.
36 changes: 36 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var dirTree = require('directory-tree');
var JSFtp = require("jsftp");
JSFtp = require('jsftp-rmr')(JSFtp);
var storage = require('electron-json-storage');

var app = angular.module('app', ['ngRoute', 'ngMaterial', 'ngAnimate', 'ngDraggable']);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl : './app/pages/main.html',
controller : 'homeCtrl'
})
.otherwise({redirectTo: '/'});
}]);


app.filter('filesize', function() {
return function(bytes, precision) {
if (bytes == 0 || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});

app.directive('showFocus', function($timeout) {
return function(scope, element, attrs) {
scope.$watch(attrs.showFocus,
function (newValue) {
$timeout(function() {
newValue && element.focus();
});
},true);
};
});
Loading