aboutsummaryrefslogtreecommitdiff
path: root/hotline/server.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-28 21:51:15 -0700
committerGitHub <noreply@github.com>2022-06-28 21:51:15 -0700
commitc681cfa3c4782b74c49a16bf08f2694cb9acba59 (patch)
tree9577c95ec8bb061f76fb890fbcc2b39b0b2a07cf /hotline/server.go
parent0db54aa79140c6656f99a851f582c84a0de04233 (diff)
parent8eb43f95a6f11b6c256ff339399e9479898b4380 (diff)
Merge pull request #50 from jhalter/implement_delNewsItem_access_controls
Implement access controls for threaded news item deletion
Diffstat (limited to 'hotline/server.go')
-rw-r--r--hotline/server.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/hotline/server.go b/hotline/server.go
index ab61e81..392c8f3 100644
--- a/hotline/server.go
+++ b/hotline/server.go
@@ -43,12 +43,10 @@ const (
var nostalgiaVersion = []byte{0, 0, 2, 0x2c} // version ID used by the Nostalgia client
type Server struct {
- Port int
- Accounts map[string]*Account
- Agreement []byte
- Clients map[uint16]*ClientConn
- ThreadedNews *ThreadedNews
-
+ Port int
+ Accounts map[string]*Account
+ Agreement []byte
+ Clients map[uint16]*ClientConn
fileTransfers map[[4]byte]*FileTransfer
Config *Config
@@ -64,6 +62,9 @@ type Server struct {
outbox chan Transaction
mux sync.Mutex
+ threadedNewsMux sync.Mutex
+ ThreadedNews *ThreadedNews
+
flatNewsMux sync.Mutex
FlatNews []byte
@@ -342,14 +343,14 @@ func (s *Server) writeBanList() error {
}
func (s *Server) writeThreadedNews() error {
- s.mux.Lock()
- defer s.mux.Unlock()
+ s.threadedNewsMux.Lock()
+ defer s.threadedNewsMux.Unlock()
out, err := yaml.Marshal(s.ThreadedNews)
if err != nil {
return err
}
- err = ioutil.WriteFile(
+ err = s.FS.WriteFile(
filepath.Join(s.ConfigDir, "ThreadedNews.yaml"),
out,
0666,