Skip to content

Commit

Permalink
feat: complete new design + ton of bug fixes + features
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored and daviddias committed Dec 5, 2017
1 parent aa8b863 commit 8b3a6fc
Show file tree
Hide file tree
Showing 84 changed files with 3,023 additions and 1,437 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/*
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
debug.log
node_modules
build
release
npm-debug.log
app.log
package-lock.json
out
*.log
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $ npm run lint
```

When you are ready to commit please be sure to follow the
[commit convention](https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md).
[commit convention](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/convention.md).

## Available Scripts

Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ A Native Application for your OS to run your own IPFS Node. Built with [Electron

## Install

You will need [Node.js](https://nodejs.org/en/) installed. Preferrably a version `>=4.0`. Also you will need [npm](npmjs.org) `>=3.0`. After that you should run
You will need [Node.js](https://nodejs.org/en/) installed, preferrably a version `>=4.0`. On macOS you may also need Xcode command line tools, which can be installed with

```bash
xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
```

Also you will need [npm](npmjs.org) `>=3.0`. After that you should run

```bash
$ git clone https://github.com/ipfs/station.git
Expand All @@ -28,7 +35,7 @@ $ npm start

This launches the app and runs it in your menu bar. Click the IPFS icon to open a console. For example (in OSX):

![](https://ipfs.io/ipfs/QmaufMhYVWPKwhC1jSb4qHBxgiahrq9ct2hgqk5cZxeE7s)
![](https://ipfs.io/ipfs/QmQjPLSWt54MdFzLAxyEvTdaYPtdTAor7A1d5ugcVcmT87)

## Usage

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@
"electron-compile": "^6.4.2",
"electron-is-dev": "^0.3.0",
"electron-squirrel-startup": "^1.0.0",
"file-extension": "^4.0.0",
"ipfs-api": "^17.1.3",
"ipfs-geoip": "^2.3.0",
"ipfs-logo": "github:ipfs/logo",
"ipfsd-ctl": "^0.26.0",
"menubar": "^5.2.3",
"moment": "^2.19.2",
"multiaddr": "^3.0.1",
"node-notifier": "^5.1.2",
"normalize.css": "^7.0.0",
"pretty-bytes": "^4.0.2",
"prop-types": "^15.6.0",
"react": "^16.1.1",
"react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4",
"react-dom": "^16.1.1",
"react-transition-group": "^2.2.1",
"react-widgets": "^4.1.1",
"winston": "^3.0.0-rc1"
},
"devDependencies": {
Expand Down Expand Up @@ -97,11 +98,12 @@
"url": "https://github.com/ipfs/station"
},
"author": "IPFS",
"authors": [
"contributors": [
"Kristoffer Ström <[email protected]>",
"David Dias <[email protected]>",
"Juan Benet <[email protected]>",
"Friedel Ziegelmayer <[email protected]>"
"Friedel Ziegelmayer <[email protected]>",
"Henrique Dias <[email protected]>"
],
"license": "MIT",
"bugs": {
Expand Down
67 changes: 47 additions & 20 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,69 @@ import fs from 'fs'
import os from 'os'
import isDev from 'electron-is-dev'
import {app} from 'electron'
import {getLogo, macOsMenuBar} from './utils/logo'
import FileHistory from './utils/file-history'

export const logoIpfsIce = (() => {
const p = path.resolve(path.join(__dirname, 'img'))

if (os.platform() === 'darwin') {
return path.join(p, 'icons/ice.png')
}

return path.join(p, 'ipfs-logo-ice.png')
})()

export const logoIpfsBlack = (() => {
const p = path.resolve(path.join(__dirname, 'img'))

if (os.platform() === 'darwin') {
return path.join(p, 'icons/black.png')
}

return path.join(p, 'ipfs-logo-black.png')
})()

const isProduction = !isDev
const currentURL = (name) => `file://${__dirname}/views/${name}.html`
const ipfsPathFile = path.join(app.getPath('appData'), 'ipfs-electron-app-node-path')
const ipfsAppData = (() => {
const p = path.join(app.getPath('appData'), 'ipfs-station')

if (!fs.existsSync(p)) {
fs.mkdirSync(p)
}

return p
})()

const ipfsPathFile = path.join(ipfsAppData, 'app-node-path')
const ipfsFileHistoryFile = path.join(ipfsAppData, 'file-history.json')

const ipfsPath = (() => {
let pathIPFS
try {

if (fs.existsSync(ipfsPathFile)) {
pathIPFS = fs.readFileSync(ipfsPathFile, 'utf-8')
} catch (e) {
} else {
pathIPFS = path.join(process.env.IPFS_PATH ||
(process.env.HOME || process.env.USERPROFILE), '.ipfs')
}

return pathIPFS
})()

export const fileHistory = new FileHistory(ipfsFileHistoryFile)

// Sets up the Logger
export const logger = winston.createLogger({
format: winston.format.json(),
transports: [
new winston.transports.File({
filename: path.join(__dirname, 'app.log'),
filename: 'error.log',
level: 'error',
handleExceptions: false
}),
new winston.transports.File({
filename: 'combined.log',
handleExceptions: false
})
]
Expand All @@ -40,25 +79,13 @@ if (isDev) {
}))
}

// Default settings for new windows
const window = {
icon: getLogo(),
title: 'IPFS Dashboard',
autoHideMenuBar: true,
width: 800,
height: 500,
webPreferences: {
webSecurity: false
}
}

// Configuration for the MenuBar
const menubar = {
dir: __dirname,
width: 300,
width: 850,
height: 400,
index: `file://${__dirname}/views/menubar.html`,
icon: (os.platform() === 'darwin') ? macOsMenuBar : getLogo(),
icon: logoIpfsBlack,
tooltip: 'Your IPFS instance',
alwaysOnTop: true,
preloadWindow: true,
Expand All @@ -74,10 +101,10 @@ export default {
isProduction,
logger,
menubar,
window,
webuiPath: '/webui',
ipfsPath,
ipfsPathFile,
ipfsFileHistoryFile,
urls: {
welcome: currentURL('welcome'),
settings: currentURL('settings')
Expand Down
4 changes: 4 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const PAGES = {
FILES: 'files',
INFO: 'info'
}
67 changes: 0 additions & 67 deletions src/controls/drag-drop.js

This file was deleted.

21 changes: 0 additions & 21 deletions src/controls/open-browser.js

This file was deleted.

22 changes: 0 additions & 22 deletions src/controls/open-console.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/controls/open-file-dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {dialog} from 'electron'
import uploadFiles from './upload-files'

export default function openFileDialog (window, ipfs, dir = false) {
return (event, callback) => {
dialog.showOpenDialog(window, {
properties: [dir ? 'openDirectory' : 'openFile', 'multiSelections']
}, (files) => {
if (!files || files.length === 0) return
uploadFiles(ipfs, event, files)
})
}
}
10 changes: 0 additions & 10 deletions src/controls/open-settings.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/controls/open-webui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {shell} from 'electron'
import {apiAddrToUrl} from './utils'
import {logger} from '../config'

export default function openWebUI (ipfs, cb) {
ipfs().config.get('Addresses.API')
.then((res) => {
shell.openExternal(apiAddrToUrl(res))
})
.catch(logger.error)
}
18 changes: 18 additions & 0 deletions src/controls/upload-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {logger, fileHistory} from '../config'
import {clipboard} from 'electron'

export default function uploadFiles (ipfs, event, files) {
ipfs()
.add(files, {recursive: true, w: files.length > 1})
.then((res) => {
logger.info('Uploading files', {files})

res.forEach((file) => {
const url = `https://ipfs.io/ipfs/${file.hash}`
clipboard.writeText(url)
logger.info('Uploaded file', {path: file.path})
fileHistory.add(file.path, file.hash)
})
})
.catch(logger.error)
}
Binary file removed src/fonts/dripicons.ttf
Binary file not shown.
Binary file removed src/fonts/maven_pro_bold-webfont.ttf
Binary file not shown.
Binary file removed src/fonts/maven_pro_medium-webfont.ttf
Binary file not shown.
Binary file removed src/fonts/maven_pro_regular-webfont.ttf
Binary file not shown.
Binary file added src/fonts/sf-pro-text-bold.otf
Binary file not shown.
Binary file added src/fonts/sf-pro-text-light.otf
Binary file not shown.
Binary file added src/fonts/sf-pro-text-medium.otf
Binary file not shown.
Binary file added src/fonts/sf-pro-text-regular.otf
Binary file not shown.
Binary file added src/fonts/sf-pro-text-semibold.otf
Binary file not shown.
Binary file added src/fonts/themify.eot
Binary file not shown.
Loading

0 comments on commit 8b3a6fc

Please sign in to comment.