feature (hot reload): make configuration easier - #91

This commit is contained in:
Mickael Kerjean
2018-07-18 01:40:38 +10:00
parent af1fa944bf
commit dd562ecc37
7 changed files with 5 additions and 108 deletions

View File

@ -1,5 +1,5 @@
import Path from 'path';
import { mime as db } from '../../server/utils/mimetype';
import db from '../../server/common/mimetype.json';
export function getMimeType(file){
let ext = Path.extname(file).replace(/^\./, '').toLowerCase();

View File

@ -25,6 +25,7 @@
<link rel="icon" type="image/png" sizes="16x16" href="/assets/logo/favicon-16x16.png">
<link rel="icon" href="/assets/logo/favicon.ico" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
<script src="/api/config"></script>
<!--[if IE]>
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js"></script>

View File

@ -6,7 +6,6 @@ import { Session } from '../model/';
import { Container, NgIf, Loader, Notification } from '../components/';
import { ForkMe, RememberMe, Credentials, Form } from './connectpage/';
import { cache, notify } from '../helpers/';
import config from '../../config_client';
import { Alert } from '../components/';
@ -22,7 +21,6 @@ export class ConnectPage extends React.Component {
}
componentWillMount(){
// adapted from: https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
function getParam(name) {
const regex = new RegExp("[?&#]" + name.replace(/[\[\]]/g, "\\$&") + "(=([^&#]*)|&|#|$)");
const results = regex.exec(window.location.href);

View File

@ -4,7 +4,6 @@ import HTML5Backend from 'react-dnd-html5-backend-filedrop';
import './filespage.scss';
import './error.scss';
import config from '../../config_client';
import { Files } from '../model/';
import { sort, onCreate, onRename, onDelete, onUpload } from './filespage.helper';
import { NgIf, Loader, Uploader, EventReceiver } from '../components/';
@ -23,7 +22,7 @@ export class FilesPage extends React.Component {
path: props.match.url.replace('/files', '') || '/',
sort: settings_get('filespage_sort') || 'type',
sort_reverse: true,
show_hidden: settings_get('filespage_show_hidden') || config.display_hidden,
show_hidden: settings_get('filespage_show_hidden') || CONFIG["display_hidden"],
view: settings_get('filespage_view') || 'grid',
files: [],
frequents: [],

View File

@ -20,7 +20,6 @@ import 'codemirror/addon/fold/foldgutter.css';
import { NgIf, Loader } from '../../components/';
import { debounce } from '../../helpers/';
import { org_shifttab } from './editor/emacs-org';
import config from '../../../config_client';
import './editor.scss';
@withRouter
@ -97,7 +96,7 @@ export class Editor extends React.Component {
value: this.props.content,
lineNumbers: true,
mode: mode,
keyMap: config.editor,
keyMap: CONFIG["editor"],
lineWrapping: true,
foldOptions: {
widget: "..."
@ -196,7 +195,7 @@ export class Editor extends React.Component {
}
loadKeybinding(){
if(config.editor === "emacs" || !config.editor){
if(CONFIG["editor"] === "emacs" || !CONFIG["editor"]){
return Promise.resolve();
}
return import(/* webpackChunkName: "editor" */'./editor/keymap_'+config.editor);

View File

@ -1,67 +0,0 @@
module.exports = {
// editor keybinding can be either: "sublime", "emacs", "vim"
editor: "emacs",
fork_button: true,
display_hidden: false,
search: {
enable: true,
max_depth: 15,
max_per_min: 20, // avoid DDOS your own server
max_folder_per_path: 30 // avoid indexing unecessary crapp like node_modules, etc...
},
connections: {
// Autofill form in the login page, this config is used to generate
// custom login form
webdav: {
label: 'WebDav',
// url: 'http://owncloud.example.com',
// username: 'username',
// password: 'password',
// advanced: false,
// path: '/home'
},
ftp: {
label: 'FTP',
// hostname: 'ftp.example.com',
// username: 'username',
// password: 'password',
// path: '/trash',
// port: 21,
// advanced: false
},
sftp: {
label: 'SFTP',
// host: 'sftp.kerjean.me',
// username: 'username',
// password: 'password',
// advanced: false,
// path: '/home/',
// port: 22,
// private_key: 'test',
},
git: {
label: 'Git',
// repo: 'http://github.com/mickael-kerjean/nuage.git',
// username: 'mickael@kerjean.me',
// password: 'superpassword',
// advanced: false,
// passphrase: 'superpassword',
// commit: '{action} ({filename}): {path}',
// branch: 'master',
// author_email: 'mickael@kerjean.me',
// author_name: 'Mickael Kerjean',
// committer_email: 'mickael@kerjean.me',
// committer_name: 'Mickael Kerjean',
},
s3: {
label: 'S3',
// access_key_id: 'my_access_key',
// secret_access_key: 'my_secret_key',
// advanced: false,
// endpoint: 'http://127.0.0.1:9000', // eg: your minio instance
// path: '/bucketname/'
},
dropbox: {label: 'Dropbox'},
gdrive: {label: 'Drive'}
}
}

View File

@ -1,33 +0,0 @@
// GOOGLE DRIVE
// 1) enable the api: https://console.developers.google.com/apis/api/drive.googleapis.com/overview
// 2) create credentials: https://console.developers.google.com/apis/credentials/oauthclient
// DROPBOX
// 1) create an third party app: https://www.dropbox.com/developers/apps/create
// -> dropbox api -> "Full Dropbox" or "App folder" -> whatever name you want ->
// -> set redirect URI to https://example.com/login ->
module.exports = {
// SERVER CONFIG
info: {
host: process.env.APPLICATION_URL || "http://nuage.kerjean.me",
usage_stats: true
},
gdrive: {
redirectURI: process.env.APPLICATION_URL+"/login",
clientID: process.env.GDRIVE_CLIENT_ID,
clientSecret: process.env.GDRIVE_CLIENT_SECRET
},
dropbox: {
clientID: process.env.DROPBOX_CLIENT_ID,
redirectURI: process.env.APPLICATION_URL+"/login"
},
transcoder: {
url: process.env.TRANSCODER_URL || null,
audio_bitrate: 128, // in kbps
audio_quality: 0,
video_codec: 'libx264',
video_bitrate: 1000 // in kbps
},
secret_key: process.env.SECRET_KEY || (Math.random()*Math.pow(10,16)).toString(32)
};