add server stats logging

see https://newrelic.com for more info
This commit is contained in:
Mystikfluu 2022-09-09 20:58:39 +02:00
parent bbf5d1b2c3
commit 381c50adf0
5 changed files with 1090 additions and 4 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ node_modules/*
*secret* *secret*
ignore/* ignore/*
avatars/* avatars/*
etc/* etc/*
*newrelic*

View File

@ -245,12 +245,28 @@ async function main(){
let all_posts = await (await fetch(`/api/getPosts?channel=${currentChannel}`)).json() let all_posts = await (await fetch(`/api/getPosts?channel=${currentChannel}`)).json()
if(!all_posts)return; if(!all_posts)return;
getById("posts").innerHTML = "" getById("posts").innerHTML = ""
getById("loading").style="display:none;"
getById("scriptonly").style = ""
highest_id = all_posts[0].post_id highest_id = all_posts[0].post_id
let post_promises = []
for(i in all_posts) { for(i in all_posts) {
let item = all_posts[i] let item = all_posts[i]
await createPost(decURIComp(item.post_user_name),decURIComp(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id,false,item.User_Avatar) let created = createPost(decURIComp(item.post_user_name),decURIComp(item.post_text),item.post_time,item.post_special_text,item.post_id,item.post_from_bot,item.post_reply_id,false,item.User_Avatar)
post_promises.push(created)
} }
await Promise.all(post_promises)
Array.from(getById("posts").childNodes).sort((a,b) => {
if(+a.id > +b.id)return -1;
if(+a.id < +b.id)return 1;
return 0
}).forEach(e => {
getById("posts").appendChild(e)
})
let links = document.getElementsByClassName("insertedlink") let links = document.getElementsByClassName("insertedlink")
for (let i = 0; i < links.length; i++) { for (let i = 0; i < links.length; i++) {
links[i].innerText = links[i].innerText.split("\/\/")[1].split("\/")[0] links[i].innerText = links[i].innerText.split("\/\/")[1].split("\/")[0]
@ -265,8 +281,7 @@ async function main(){
} }
} }
getById("loading").style="display:none;"
getById("scriptonly").style = ""
} }
async function reply(postid) { async function reply(postid) {

1067
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
"html-minifier-terser": "^7.0.0", "html-minifier-terser": "^7.0.0",
"lru-cache": "^7.14.0", "lru-cache": "^7.14.0",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"newrelic": "^9.0.3",
"sharp": "^0.30.7", "sharp": "^0.30.7",
"spdy": "^4.0.2", "spdy": "^4.0.2",
"uglify-js": "^3.17.0", "uglify-js": "^3.17.0",

View File

@ -1,3 +1,5 @@
import "newrelic"
import http from "http"; import http from "http";
import * as express from "express"; import * as express from "express";
import useragent from "express-useragent"; import useragent from "express-useragent";