mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2026-04-28 11:17:38 +02:00
images update, sync since all time option, qdb write location fixes, lastUsersSync fixes
This commit is contained in:
+10
-5
@@ -1,5 +1,5 @@
|
||||
import { PeerInfo } from '../types/basicTypes'
|
||||
import { paths } from './files'
|
||||
import { files, paths, readAndValidateFile } from './files'
|
||||
import { parseCookie, post } from './networkUtils'
|
||||
import utils from './utils'
|
||||
|
||||
@@ -14,10 +14,15 @@ export function isPeerSameAs(peer1: PeerInfo, peer2: PeerInfo): boolean {
|
||||
return peer1.host === peer2.host && peer1.port === peer2.port
|
||||
}
|
||||
|
||||
export function updatePeersFile(
|
||||
peers: PeerInfo[],
|
||||
updatedPeer: PeerInfo
|
||||
): void {
|
||||
export function updatePeersFile(updatedPeer: PeerInfo): void {
|
||||
const newVal = readAndValidateFile<PeerInfo[]>(files.peersFile)
|
||||
let peers
|
||||
if (newVal) {
|
||||
peers = newVal
|
||||
}
|
||||
if (!peers)
|
||||
throw new Error('Peers file was invalid while trying to update it!')
|
||||
|
||||
const updatedPeers = peers.map((x) => {
|
||||
if (isPeerSameAs(updatedPeer, x)) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user