|
|
|
@ -10,7 +10,7 @@ const languages = require('../../languages');
|
|
|
|
|
const navigationAdmin = require('../../navigation/admin');
|
|
|
|
|
const social = require('../../social');
|
|
|
|
|
const api = require('../../api');
|
|
|
|
|
|
|
|
|
|
const pagination = require('../../pagination');
|
|
|
|
|
const helpers = require('../helpers');
|
|
|
|
|
const translator = require('../../translator');
|
|
|
|
|
|
|
|
|
@ -104,9 +104,18 @@ settingsController.navigation = async function (req, res) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
settingsController.api = async (req, res) => {
|
|
|
|
|
const tokens = await api.utils.tokens.list();
|
|
|
|
|
const page = parseInt(req.query.page, 10) || 1;
|
|
|
|
|
const resultsPerPage = 50;
|
|
|
|
|
const start = Math.max(0, page - 1) * resultsPerPage;
|
|
|
|
|
const stop = start + resultsPerPage - 1;
|
|
|
|
|
const [tokens, count] = await Promise.all([
|
|
|
|
|
api.utils.tokens.list(start, stop),
|
|
|
|
|
api.utils.tokens.count(),
|
|
|
|
|
]);
|
|
|
|
|
const pageCount = Math.ceil(count / resultsPerPage);
|
|
|
|
|
res.render('admin/settings/api', {
|
|
|
|
|
title: '[[admin/menu:settings/api]]',
|
|
|
|
|
tokens,
|
|
|
|
|
pagination: pagination.create(page, pageCount, req.query),
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|