mirror of https://github.com/kern/filepizza
prettier
parent
5c3306b9c6
commit
0dc1b6fa04
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
semi: false,
|
||||||
|
trailingComma: 'all',
|
||||||
|
singleQuote: true,
|
||||||
|
printWidth: 80,
|
||||||
|
tabWidth: 2,
|
||||||
|
};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const DownloadPage = () => {
|
||||||
|
return <div />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DownloadPage
|
||||||
@ -1,8 +1,7 @@
|
|||||||
import alt from '../alt';
|
import alt from '../alt'
|
||||||
|
|
||||||
export default alt.createActions(class DownloadActions {
|
export default alt.createActions(class DownloadActions {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.generateActions('requestDownload');
|
this.generateActions('requestDownload')
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import alt from '../alt';
|
import alt from '../alt'
|
||||||
|
|
||||||
export default alt.createActions(class SupportActions {
|
export default alt.createActions(class SupportActions {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.generateActions('isChrome', 'noSupport');
|
this.generateActions('isChrome', 'noSupport')
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import alt from '../alt';
|
import alt from '../alt'
|
||||||
|
|
||||||
export default alt.createActions(class UploadActions {
|
export default alt.createActions(class UploadActions {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.generateActions('uploadFile');
|
this.generateActions('uploadFile')
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import Alt from 'alt';
|
import Alt from 'alt'
|
||||||
|
|
||||||
export default new Alt()
|
export default new Alt()
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
import "babel-polyfill";
|
import 'babel-polyfill'
|
||||||
import "./index.styl";
|
import './index.styl'
|
||||||
import React from "react";
|
import React from 'react'
|
||||||
import ReactRouter from "react-router";
|
import ReactRouter from 'react-router'
|
||||||
import webrtcSupport from 'webrtcsupport';
|
import webrtcSupport from 'webrtcsupport'
|
||||||
import routes from './routes';
|
import routes from './routes'
|
||||||
import alt from './alt';
|
import alt from './alt'
|
||||||
import SupportActions from "./actions/SupportActions";
|
import SupportActions from './actions/SupportActions'
|
||||||
|
|
||||||
const bootstrap = document.getElementById("bootstrap").innerHTML;
|
const bootstrap = document.getElementById('bootstrap').innerHTML
|
||||||
alt.bootstrap(bootstrap);
|
alt.bootstrap(bootstrap)
|
||||||
|
|
||||||
window.FilePizza = () => {
|
window.FilePizza = () => {
|
||||||
ReactRouter.run(routes, ReactRouter.HistoryLocation, Handler => {
|
ReactRouter.run(routes, ReactRouter.HistoryLocation, Handler => {
|
||||||
React.render(<Handler data={bootstrap} />, document);
|
React.render(<Handler data={bootstrap} />, document)
|
||||||
})
|
})
|
||||||
if (!webrtcSupport.support) {
|
if (!webrtcSupport.support) {
|
||||||
SupportActions.noSupport();
|
SupportActions.noSupport()
|
||||||
}
|
}
|
||||||
|
|
||||||
const isChrome = navigator.userAgent.toLowerCase().includes('chrome')
|
const isChrome = navigator.userAgent.toLowerCase().includes('chrome')
|
||||||
;if (isChrome) {
|
if (isChrome) {
|
||||||
SupportActions.isChrome()
|
SupportActions.isChrome()
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
const twilio = require("twilio");
|
|
||||||
var winston = require("winston");
|
|
||||||
if (process.env.TWILIO_SID && process.env.TWILIO_TOKEN) {
|
|
||||||
const twilioSID = process.env.TWILIO_SID;
|
|
||||||
const twilioToken = process.env.TWILIO_TOKEN;
|
|
||||||
var client = twilio(twilioSID, twilioToken);
|
|
||||||
winston.info("Using Twilio TURN service");
|
|
||||||
} else {
|
|
||||||
var client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let ICE_SERVERS = [
|
|
||||||
{
|
|
||||||
urls: "stun:stun.l.google.com:19302",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
if (process.env.ICE_SERVERS) {
|
|
||||||
ICE_SERVERS = JSON.parse(process.env.ICE_SERVERS)
|
|
||||||
}
|
|
||||||
|
|
||||||
const CACHE_LIFETIME = 5 * 60 * 1000; // 5 minutes
|
|
||||||
let cachedPromise = null;
|
|
||||||
|
|
||||||
function clearCache() {
|
|
||||||
cachedPromise = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.getICEServers = function() {
|
|
||||||
if (client == null) {
|
|
||||||
return Promise.resolve(ICE_SERVERS)
|
|
||||||
}
|
|
||||||
if (cachedPromise) {
|
|
||||||
return cachedPromise
|
|
||||||
}
|
|
||||||
|
|
||||||
cachedPromise = new Promise((resolve, reject) => {
|
|
||||||
client.tokens.create({}, (err, token) => {
|
|
||||||
if (err) {
|
|
||||||
winston.error(err);
|
|
||||||
return resolve(DEFAULT_ICE_SERVERS);
|
|
||||||
}
|
|
||||||
|
|
||||||
winston.info("Retrieved ICE servers from Twilio");
|
|
||||||
;setTimeout(clearCache, CACHE_LIFETIME)
|
|
||||||
resolve(token.ice_servers);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
return cachedPromise;
|
|
||||||
}
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
const twilio = require('twilio')
|
||||||
|
const winston = require('winston')
|
||||||
|
|
||||||
|
if (process.env.TWILIO_SID && process.env.TWILIO_TOKEN) {
|
||||||
|
const twilioSID = process.env.TWILIO_SID
|
||||||
|
const twilioToken = process.env.TWILIO_TOKEN
|
||||||
|
var client = twilio(twilioSID, twilioToken)
|
||||||
|
winston.info('Using Twilio TURN service')
|
||||||
|
} else {
|
||||||
|
var client = null
|
||||||
|
}
|
||||||
|
|
||||||
|
let ICE_SERVERS = [
|
||||||
|
{
|
||||||
|
urls: 'stun:stun.l.google.com:19302',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
if (process.env.ICE_SERVERS) {
|
||||||
|
ICE_SERVERS = JSON.parse(process.env.ICE_SERVERS)
|
||||||
|
}
|
||||||
|
|
||||||
|
const CACHE_LIFETIME = 5 * 60 * 1000 // 5 minutes
|
||||||
|
let cachedPromise = null
|
||||||
|
|
||||||
|
function clearCache() {
|
||||||
|
cachedPromise = null
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.getICEServers = function() {
|
||||||
|
if (client == null) {
|
||||||
|
return Promise.resolve(ICE_SERVERS)
|
||||||
|
}
|
||||||
|
if (cachedPromise) {
|
||||||
|
return cachedPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedPromise = new Promise((resolve, reject) => {
|
||||||
|
client.tokens.create({}, (err, token) => {
|
||||||
|
if (err) {
|
||||||
|
winston.error(err)
|
||||||
|
return resolve(DEFAULT_ICE_SERVERS)
|
||||||
|
}
|
||||||
|
|
||||||
|
winston.info('Retrieved ICE servers from Twilio')
|
||||||
|
setTimeout(clearCache, CACHE_LIFETIME)
|
||||||
|
resolve(token.ice_servers)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return cachedPromise
|
||||||
|
}
|
||||||
@ -1,15 +1,17 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
;const BUNDLE_PATH = path.resolve(__dirname, '../../dist/bundle.js')
|
|
||||||
;if (process.env.NODE_ENV === 'production') {
|
const BUNDLE_PATH = path.resolve(__dirname, '../../dist/bundle.js')
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
module.exports = function (req, res) {
|
module.exports = function (req, res) {
|
||||||
res.sendFile(BUNDLE_PATH)
|
res.sendFile(BUNDLE_PATH)
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
const webpackMiddleware = require('webpack-dev-middleware')
|
const webpackMiddleware = require('webpack-dev-middleware')
|
||||||
;const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
;const config = require('../../webpack.config.js')
|
const config = require('../../webpack.config.js')
|
||||||
;config.output.filename = '/app.js';
|
|
||||||
config.output.path = '/';
|
config.output.filename = '/app.js'
|
||||||
|
config.output.path = '/'
|
||||||
|
|
||||||
module.exports = webpackMiddleware(webpack(config))
|
module.exports = webpackMiddleware(webpack(config))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
const path = require("path");
|
const path = require('path')
|
||||||
const express = require("express");
|
const express = require('express')
|
||||||
let STATIC_PATH = path.resolve(__dirname, "../static");
|
|
||||||
module.exports = express.static(STATIC_PATH);
|
const STATIC_PATH = path.resolve(__dirname, '../static')
|
||||||
|
|
||||||
|
module.exports = express.static(STATIC_PATH)
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
import SupportActions from '../actions/SupportActions';
|
import SupportActions from '../actions/SupportActions'
|
||||||
import alt from '../alt';
|
import alt from '../alt'
|
||||||
|
|
||||||
export default alt.createStore(
|
export default alt.createStore(
|
||||||
class ErrorStore {
|
class ErrorStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.bindActions(SupportActions)
|
this.bindActions(SupportActions)
|
||||||
|
|
||||||
this.status = 404;
|
this.status = 404
|
||||||
this.message = "Not Found";
|
this.message = 'Not Found'
|
||||||
this.stack = null
|
this.stack = null
|
||||||
}
|
}
|
||||||
|
|
||||||
onNoSupport() {
|
onNoSupport() {
|
||||||
this.status = 400
|
this.status = 400
|
||||||
this.message = "No WebRTC Support. Please use Chrome or Firefox.";
|
this.message = 'No WebRTC Support. Please use Chrome or Firefox.'
|
||||||
this.stack = null
|
this.stack = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'ErrorStore'
|
'ErrorStore',
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,100 +0,0 @@
|
|||||||
export default [
|
|
||||||
"alfalfa",
|
|
||||||
"almonds",
|
|
||||||
"anchovies",
|
|
||||||
"artichoke",
|
|
||||||
"avocado",
|
|
||||||
"bacon",
|
|
||||||
"basil",
|
|
||||||
"bayleaves",
|
|
||||||
"bbqchicken",
|
|
||||||
"beans",
|
|
||||||
"beef",
|
|
||||||
"beetroot",
|
|
||||||
"bluecheese",
|
|
||||||
"brie",
|
|
||||||
"broccoli",
|
|
||||||
"cajunchicken",
|
|
||||||
"camembert",
|
|
||||||
"capers",
|
|
||||||
"capicolla",
|
|
||||||
"cardamon",
|
|
||||||
"carrot",
|
|
||||||
"cauliflower",
|
|
||||||
"cheddar",
|
|
||||||
"chickenmasala",
|
|
||||||
"chickentikka",
|
|
||||||
"chili",
|
|
||||||
"chives",
|
|
||||||
"chorizo",
|
|
||||||
"cilantro",
|
|
||||||
"colby",
|
|
||||||
"coriander",
|
|
||||||
"crayfish",
|
|
||||||
"cumin",
|
|
||||||
"dill",
|
|
||||||
"duck",
|
|
||||||
"eggplant",
|
|
||||||
"fenugreek",
|
|
||||||
"feta",
|
|
||||||
"fungi",
|
|
||||||
"garlic",
|
|
||||||
"goatcheese",
|
|
||||||
"gorgonzola",
|
|
||||||
"gouda",
|
|
||||||
"ham",
|
|
||||||
"jalapeno",
|
|
||||||
"laurel",
|
|
||||||
"leeks",
|
|
||||||
"lettuce",
|
|
||||||
"limburger",
|
|
||||||
"lobster",
|
|
||||||
"manchego",
|
|
||||||
"marjoram",
|
|
||||||
"meatballs",
|
|
||||||
"melon",
|
|
||||||
"montereyjack",
|
|
||||||
"mozzarella",
|
|
||||||
"muenster",
|
|
||||||
"mushrooms",
|
|
||||||
"olives",
|
|
||||||
"onion",
|
|
||||||
"oregano",
|
|
||||||
"oysters",
|
|
||||||
"parsley",
|
|
||||||
"parmesan",
|
|
||||||
"peanuts",
|
|
||||||
"peas",
|
|
||||||
"pecans",
|
|
||||||
"pepperoni",
|
|
||||||
"peppers",
|
|
||||||
"pineapple",
|
|
||||||
"pinenuts",
|
|
||||||
"pistachios",
|
|
||||||
"prawn",
|
|
||||||
"prosciutto",
|
|
||||||
"provolone",
|
|
||||||
"ricotta",
|
|
||||||
"romano",
|
|
||||||
"roquefort",
|
|
||||||
"rosemary",
|
|
||||||
"salami",
|
|
||||||
"salmon",
|
|
||||||
"sausage",
|
|
||||||
"scallions",
|
|
||||||
"shallots",
|
|
||||||
"shrimp",
|
|
||||||
"snowpeas",
|
|
||||||
"spinach",
|
|
||||||
"squash",
|
|
||||||
"squid",
|
|
||||||
"sweetcorn",
|
|
||||||
"tomatoes",
|
|
||||||
"tuna",
|
|
||||||
"turkey",
|
|
||||||
"venison",
|
|
||||||
"walnuts",
|
|
||||||
"watercress",
|
|
||||||
"whitebait",
|
|
||||||
"zucchini",
|
|
||||||
]
|
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
export default [
|
||||||
|
'alfalfa',
|
||||||
|
'almonds',
|
||||||
|
'anchovies',
|
||||||
|
'artichoke',
|
||||||
|
'avocado',
|
||||||
|
'bacon',
|
||||||
|
'basil',
|
||||||
|
'bayleaves',
|
||||||
|
'bbqchicken',
|
||||||
|
'beans',
|
||||||
|
'beef',
|
||||||
|
'beetroot',
|
||||||
|
'bluecheese',
|
||||||
|
'brie',
|
||||||
|
'broccoli',
|
||||||
|
'cajunchicken',
|
||||||
|
'camembert',
|
||||||
|
'capers',
|
||||||
|
'capicolla',
|
||||||
|
'cardamon',
|
||||||
|
'carrot',
|
||||||
|
'cauliflower',
|
||||||
|
'cheddar',
|
||||||
|
'chickenmasala',
|
||||||
|
'chickentikka',
|
||||||
|
'chili',
|
||||||
|
'chives',
|
||||||
|
'chorizo',
|
||||||
|
'cilantro',
|
||||||
|
'colby',
|
||||||
|
'coriander',
|
||||||
|
'crayfish',
|
||||||
|
'cumin',
|
||||||
|
'dill',
|
||||||
|
'duck',
|
||||||
|
'eggplant',
|
||||||
|
'fenugreek',
|
||||||
|
'feta',
|
||||||
|
'fungi',
|
||||||
|
'garlic',
|
||||||
|
'goatcheese',
|
||||||
|
'gorgonzola',
|
||||||
|
'gouda',
|
||||||
|
'ham',
|
||||||
|
'jalapeno',
|
||||||
|
'laurel',
|
||||||
|
'leeks',
|
||||||
|
'lettuce',
|
||||||
|
'limburger',
|
||||||
|
'lobster',
|
||||||
|
'manchego',
|
||||||
|
'marjoram',
|
||||||
|
'meatballs',
|
||||||
|
'melon',
|
||||||
|
'montereyjack',
|
||||||
|
'mozzarella',
|
||||||
|
'muenster',
|
||||||
|
'mushrooms',
|
||||||
|
'olives',
|
||||||
|
'onion',
|
||||||
|
'oregano',
|
||||||
|
'oysters',
|
||||||
|
'parsley',
|
||||||
|
'parmesan',
|
||||||
|
'peanuts',
|
||||||
|
'peas',
|
||||||
|
'pecans',
|
||||||
|
'pepperoni',
|
||||||
|
'peppers',
|
||||||
|
'pineapple',
|
||||||
|
'pinenuts',
|
||||||
|
'pistachios',
|
||||||
|
'prawn',
|
||||||
|
'prosciutto',
|
||||||
|
'provolone',
|
||||||
|
'ricotta',
|
||||||
|
'romano',
|
||||||
|
'roquefort',
|
||||||
|
'rosemary',
|
||||||
|
'salami',
|
||||||
|
'salmon',
|
||||||
|
'sausage',
|
||||||
|
'scallions',
|
||||||
|
'shallots',
|
||||||
|
'shrimp',
|
||||||
|
'snowpeas',
|
||||||
|
'spinach',
|
||||||
|
'squash',
|
||||||
|
'squid',
|
||||||
|
'sweetcorn',
|
||||||
|
'tomatoes',
|
||||||
|
'tuna',
|
||||||
|
'turkey',
|
||||||
|
'venison',
|
||||||
|
'walnuts',
|
||||||
|
'watercress',
|
||||||
|
'whitebait',
|
||||||
|
'zucchini',
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue