Experimental port to Firebase hosting

This commit is contained in:
Michael Jackson
2019-01-05 16:50:05 -08:00
parent e4d6df255e
commit 31e7d3865a
300 changed files with 129300 additions and 5817 deletions

View File

@ -1,7 +1,5 @@
const BlacklistAPI = require('../../BlacklistAPI');
import { removeAllPackages } from '../../utils/blacklist';
function clearBlacklist(done) {
BlacklistAPI.removeAllPackages().then(done, done);
export default function clearBlacklist(done) {
removeAllPackages().then(done, done);
}
module.exports = clearBlacklist;

View File

@ -1,7 +1,5 @@
const data = require('../../utils/data');
import data from '../../utils/data';
function closeDatabase() {
export default function closeDatabase() {
data.quit();
}
module.exports = closeDatabase;

View File

@ -1,13 +1,11 @@
const withToken = require('./withToken');
import withToken from './withToken';
function encodeBase64(token) {
return Buffer.from(token).toString('base64');
}
function withAuthHeader(scopes, done) {
export default function withAuthHeader(scopes, done) {
withToken(scopes, token => {
done(encodeBase64(token));
});
}
module.exports = withAuthHeader;

View File

@ -1,7 +1,5 @@
const BlacklistAPI = require('../../BlacklistAPI');
import { addPackage } from '../../utils/blacklist';
function withBlacklist(blacklist, done) {
Promise.all(blacklist.map(BlacklistAPI.addPackage)).then(done);
export default function withBlacklist(blacklist, done) {
Promise.all(blacklist.map(addPackage)).then(done);
}
module.exports = withBlacklist;

View File

@ -1,12 +1,10 @@
const withToken = require('./withToken');
const AuthAPI = require('../../AuthAPI');
import { revokeToken } from '../../utils/auth';
import withToken from './withToken';
function withRevokedToken(scopes, done) {
export default function withRevokedToken(scopes, done) {
withToken(scopes, token => {
AuthAPI.revokeToken(token).then(() => {
revokeToken(token).then(() => {
done(token);
});
});
}
module.exports = withRevokedToken;

View File

@ -1,7 +1,5 @@
const AuthAPI = require('../../AuthAPI');
import { createToken } from '../../utils/auth';
function withToken(scopes, done) {
AuthAPI.createToken(scopes).then(done);
export default function withToken(scopes, done) {
createToken(scopes).then(done);
}
module.exports = withToken;