2018-10-25 02:07:10 +00:00
|
|
|
const choo = require('choo');
|
|
|
|
const download = require('./ui/download');
|
2018-11-12 19:13:31 +00:00
|
|
|
const body = require('./ui/body');
|
2018-10-25 02:07:10 +00:00
|
|
|
|
2019-08-26 15:58:34 +00:00
|
|
|
module.exports = function(app = choo({ hash: true })) {
|
2018-10-30 18:37:33 +00:00
|
|
|
app.route('/', body(require('./ui/home')));
|
2018-10-25 02:07:10 +00:00
|
|
|
app.route('/download/:id', body(download));
|
|
|
|
app.route('/download/:id/:key', body(download));
|
|
|
|
app.route('/unsupported/:reason', body(require('./ui/unsupported')));
|
|
|
|
app.route('/error', body(require('./ui/error')));
|
|
|
|
app.route('/blank', body(require('./ui/blank')));
|
2019-02-25 19:44:44 +00:00
|
|
|
app.route('/oauth', function(state, emit) {
|
2019-02-12 19:50:06 +00:00
|
|
|
emit('authenticate', state.query.code, state.query.state);
|
2018-10-25 02:07:10 +00:00
|
|
|
});
|
2020-07-25 18:22:57 +00:00
|
|
|
app.route('/login', function(state, emit) {
|
|
|
|
emit('replaceState', '/');
|
|
|
|
setTimeout(() => emit('render'));
|
|
|
|
});
|
2018-10-25 02:07:10 +00:00
|
|
|
app.route('*', body(require('./ui/notFound')));
|
|
|
|
return app;
|
|
|
|
};
|