forked from f0ck/f0ckv2
change psql-lib from knex to postgres.js
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import sql from "../../inc/sql.mjs";
|
||||
import db from "../../inc/sql.mjs";
|
||||
|
||||
const auth = async (req, res, next) => {
|
||||
if(!req.session)
|
||||
@@ -9,9 +9,16 @@ const auth = async (req, res, next) => {
|
||||
export default (router, tpl) => {
|
||||
router.group(/^\/settings/, group => {
|
||||
group.get(/$/, auth, async (req, res) => {
|
||||
const sessions = await sql("user_sessions")
|
||||
/*const sessions = await sql("user_sessions")
|
||||
.where("user_id", req.session.id)
|
||||
.orderBy("last_used", "desc");
|
||||
.orderBy("last_used", "desc");*/
|
||||
|
||||
const sessions = await db`
|
||||
select *
|
||||
from user_sessions
|
||||
where user_id = ${ +req.session.id }
|
||||
order by last_used desc
|
||||
`;
|
||||
|
||||
res.reply({
|
||||
body: tpl.render('settings', {
|
||||
|
Reference in New Issue
Block a user