[fix] comments/resources
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### unreleased
|
|
||||||
|
### 0.17.11
|
||||||
- [refactor] s/fed_user/ap_user
|
- [refactor] s/fed_user/ap_user
|
||||||
- [fedi] admin moderation
|
- [fedi] admin moderation
|
||||||
|
|
||||||
|
### 0.17.10
|
||||||
- [refactor] s/comment/resource/
|
- [refactor] s/comment/resource/
|
||||||
- [refactor] remove `username` field
|
- [refactor] remove `username` field
|
||||||
- [doc] about and federation
|
- [doc] about and federation
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
const { event: Event, user: User, comment: Comment } = require('../api/models')
|
const { event: Event, user: User, resource: Resource } = require('../api/models')
|
||||||
const cors = require('cors')
|
const cors = require('cors')
|
||||||
const settingsController = require('../api/controller/settings')
|
const settingsController = require('../api/controller/settings')
|
||||||
const version = require('../../package.json').version
|
const version = require('../../package.json').version
|
||||||
@@ -50,6 +50,8 @@ router.get('/webfinger', (req, res) => {
|
|||||||
router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
|
router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
|
||||||
const usersCount = (await User.findAndCountAll()).count
|
const usersCount = (await User.findAndCountAll()).count
|
||||||
const eventsCount = (await Event.findAndCountAll()).count
|
const eventsCount = (await Event.findAndCountAll()).count
|
||||||
|
const resourcesCount = (await Resource.findAndCountAll()).count
|
||||||
|
|
||||||
const ret = {
|
const ret = {
|
||||||
metadata: {
|
metadata: {
|
||||||
nodeDescription: req.settings.description,
|
nodeDescription: req.settings.description,
|
||||||
@@ -64,7 +66,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
|
|||||||
},
|
},
|
||||||
version: req.params.nodeinfo_version,
|
version: req.params.nodeinfo_version,
|
||||||
usage: {
|
usage: {
|
||||||
localComments: 0,
|
localComments: resourcesCount,
|
||||||
localPosts: eventsCount,
|
localPosts: eventsCount,
|
||||||
users: {
|
users: {
|
||||||
total: usersCount
|
total: usersCount
|
||||||
@@ -81,7 +83,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
|
|||||||
router.get('/x-nodeinfo2', async (req, res) => {
|
router.get('/x-nodeinfo2', async (req, res) => {
|
||||||
const usersCount = (await User.findAndCountAll()).count
|
const usersCount = (await User.findAndCountAll()).count
|
||||||
const eventsCount = (await Event.findAndCountAll()).count
|
const eventsCount = (await Event.findAndCountAll()).count
|
||||||
const commentsCount = (await Comment.findAndCountAll()).count
|
const resourcesCount = (await Resource.findAndCountAll()).count
|
||||||
|
|
||||||
const ret = {
|
const ret = {
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
@@ -98,7 +100,7 @@ router.get('/x-nodeinfo2', async (req, res) => {
|
|||||||
total: usersCount
|
total: usersCount
|
||||||
},
|
},
|
||||||
localPosts: eventsCount,
|
localPosts: eventsCount,
|
||||||
localComments: commentsCount
|
localComments: resourcesCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.json(ret)
|
res.json(ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user