mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-07-17 16:47:05 +00:00
feat: disable stats endpoint if enableMetrics is false
This commit is contained in:
parent
45a906e19d
commit
40884fa96b
11 changed files with 462 additions and 647 deletions
|
|
@ -9,22 +9,29 @@ export const ShoutPage = ()=>{
|
|||
const [message, setMessage] = useState<string>("");
|
||||
const [sticky, setSticky] = useState<boolean>(false);
|
||||
const socket = useStore(state => state.settingsSocket);
|
||||
const pluginSocket = useStore(state => state.pluginsSocket);
|
||||
const [shouts, setShouts] = useState<ShoutType[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/stats')
|
||||
.then(response => response.json())
|
||||
.then(data => setTotalUsers(data.totalUsers));
|
||||
}, []);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if(socket) {
|
||||
if(socket && pluginSocket) {
|
||||
console.log('Socket connected', socket.id);
|
||||
socket.on('shout', (shout) => {
|
||||
setShouts([...shouts, shout])
|
||||
})
|
||||
pluginSocket.on('results:stats', (statData) => {
|
||||
console.log('Shoutdata', statData);
|
||||
setTotalUsers(statData.totalUsers);
|
||||
})
|
||||
}
|
||||
}, [socket, shouts])
|
||||
}, [socket, shouts, pluginSocket])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pluginSocket) {
|
||||
pluginSocket.emit('getStats', {});
|
||||
}
|
||||
}, [pluginSocket]);
|
||||
|
||||
const sendMessage = () => {
|
||||
socket?.emit('shout', {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ export default defineConfig({
|
|||
'/admin-auth/': {
|
||||
target: 'http://localhost:9001',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/stats': {
|
||||
target: 'http://localhost:9001',
|
||||
changeOrigin: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue