Switched to tabs. Adding missing actor entries when scraping actors, with batch ID.

This commit is contained in:
2020-05-14 04:26:05 +02:00
parent f1eb29c713
commit 11eb66f834
178 changed files with 16594 additions and 16929 deletions

View File

@@ -15,68 +15,68 @@ const logger = require('../logger')(__filename);
const { ActorPlugins, SitePlugins, ReleasePlugins } = require('./plugins/plugins');
const {
fetchReleases,
fetchReleases,
} = require('./releases');
function initServer() {
const app = express();
const router = Router();
const app = express();
const router = Router();
const connectionString = `postgres://${config.database.user}:${config.database.password}@${config.database.host}:5432/${config.database.database}`;
const connectionString = `postgres://${config.database.user}:${config.database.password}@${config.database.host}:5432/${config.database.database}`;
app.use(postgraphile(
connectionString,
'public',
{
// watchPg: true,
dynamicJson: true,
graphiql: true,
enhanceGraphiql: true,
allowExplain: () => true,
simpleCollections: 'only',
graphileBuildOptions: {
pgOmitListSuffix: true,
connectionFilterRelations: true,
},
appendPlugins: [
PgSimplifyInflectorPlugin,
PgConnectionFilterPlugin,
PgOrderByRelatedPlugin,
...ActorPlugins,
...SitePlugins,
...ReleasePlugins,
],
},
));
app.use(postgraphile(
connectionString,
'public',
{
// watchPg: true,
dynamicJson: true,
graphiql: true,
enhanceGraphiql: true,
allowExplain: () => true,
simpleCollections: 'only',
graphileBuildOptions: {
pgOmitListSuffix: true,
connectionFilterRelations: true,
},
appendPlugins: [
PgSimplifyInflectorPlugin,
PgConnectionFilterPlugin,
PgOrderByRelatedPlugin,
...ActorPlugins,
...SitePlugins,
...ReleasePlugins,
],
},
));
app.set('view engine', 'ejs');
app.set('view engine', 'ejs');
router.use('/media', express.static(config.media.path));
router.use(express.static('public'));
router.use('/media', express.static(config.media.path));
router.use(express.static('public'));
router.use('/img', (req, res) => {
res.status(404).send();
});
router.use('/img', (req, res) => {
res.status(404).send();
});
router.use(bodyParser.json({ strict: false }));
router.use(bodyParser.json({ strict: false }));
router.get('/api/releases', fetchReleases);
router.get('/api/releases', fetchReleases);
router.get('*', (req, res) => {
res.render(path.join(__dirname, '../../assets/index.ejs'), {
env: JSON.stringify({
sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'),
}),
});
});
router.get('*', (req, res) => {
res.render(path.join(__dirname, '../../assets/index.ejs'), {
env: JSON.stringify({
sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'),
}),
});
});
app.use(router);
app.use(router);
const server = app.listen(config.web.port, config.web.host, () => {
const { address, port } = server.address();
const server = app.listen(config.web.port, config.web.host, () => {
const { address, port } = server.address();
logger.info(`Web server listening on ${address}:${port}`);
});
logger.info(`Web server listening on ${address}:${port}`);
});
}
module.exports = initServer;