Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 69 additions & 88 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"csv-stringify": "^6.4.2",
"dotenv": "^16.0.3",
"es6-promisify": "^7.0.0",
"escape-html": "^1.0.3",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
"express-handlebars": "^6.0.7",
Expand All @@ -26,8 +27,7 @@
"open-graph-scraper": "^5.2.3",
"sqlite": "^5.0.1",
"sqlite3": "^5.1.5",
"string-strip-html": "^13.4.2",
"escape-html": "^1.0.3"
"string-strip-html": "^13.4.2"
},
"engines": {
"node": ">=16.x"
Expand All @@ -49,6 +49,7 @@
"eslint": "^8.43.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"nodemon": "^2.0.20",
Expand Down
19 changes: 7 additions & 12 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import cors from 'cors';
import { create } from 'express-handlebars';
import escapeHTML from 'escape-html';

import { domain, account, simpleLogger, actorInfo, replaceEmptyText } from './src/util.js';
import { domain, simpleLogger, getActorInfo, replaceEmptyText } from './src/util.js';
import session, { isAuthenticated } from './src/session-auth.js';
import * as bookmarksDb from './src/bookmarks-db.js';
import * as apDb from './src/activity-pub-db.js';
import * as db from './src/database.js';
import './src/boot.js';

import routes from './src/routes/index.js';

Expand All @@ -22,15 +23,15 @@ app.use(express.json());
app.use(express.json({ type: 'application/activity+json' }));
app.use(session());

app.use((req, res, next) => {
app.use(async (req, res, next) => {
res.locals.loggedIn = req.session.loggedIn;
const { displayName } = await getActorInfo();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels not great to make this database call before every page load but I think this is just the world we live in

res.locals.siteName = displayName;
return next();
});

app.set('site_name', actorInfo.displayName || 'Postmarks');
app.set('bookmarksDb', bookmarksDb);
app.set('apDb', apDb);
app.set('account', account);
app.set('db', db);
app.set('domain', domain);

app.disable('x-powered-by');
Expand Down Expand Up @@ -61,12 +62,6 @@ const hbs = create({
const returnText = escapeHTML(text);
return returnText?.replace('\n', '<br/>');
},
siteName() {
return app.get('site_name');
},
account() {
return app.get('account');
},
feedUrl() {
return `https://${app.get('domain')}/index.xml`;
},
Expand Down
254 changes: 0 additions & 254 deletions src/activity-pub-db.js

This file was deleted.

Loading