Signed-off-by: Seongmin Lee git@boltless.me
flake.nix
flake.nix
This file has not been changed.
knotmirror/knotstream/slurper.go
knotmirror/knotstream/slurper.go
This file has not been changed.
knotmirror/resyncer.go
knotmirror/resyncer.go
This file has not been changed.
nix/modules/knotmirror.nix
nix/modules/knotmirror.nix
This file has not been changed.
nix/pkgs/knotmirror.nix
nix/pkgs/knotmirror.nix
This file has not been changed.
+2
-2
nix/vm.nix
+2
-2
nix/vm.nix
···
175
175
in {
176
176
knot = mkDataSyncScripts "/mnt/knot-data" config.services.tangled.knot.stateDir;
177
177
spindle = mkDataSyncScripts "/mnt/spindle-data" (builtins.dirOf config.services.tangled.spindle.server.dbPath);
178
-
knotmirror.after = ["postgresql.service"];
179
-
tap-knotmirror.after = ["postgresql.service"];
178
+
knotmirror.after = ["postgresql.target"];
179
+
tap-knotmirror.after = ["postgresql.target"];
180
180
};
181
181
})
182
182
];
+17
-5
knotmirror/models/models.go
+17
-5
knotmirror/models/models.go
···
85
85
HostStatusBanned,
86
86
}
87
87
88
+
func (h *Host) URL() string {
89
+
if h.NoSSL {
90
+
return fmt.Sprintf("http://%s", h.Hostname)
91
+
} else {
92
+
return fmt.Sprintf("https://%s", h.Hostname)
93
+
}
94
+
}
95
+
96
+
func (h *Host) WsURL() string {
97
+
if h.NoSSL {
98
+
return fmt.Sprintf("ws://%s", h.Hostname)
99
+
} else {
100
+
return fmt.Sprintf("wss://%s", h.Hostname)
101
+
}
102
+
}
103
+
88
104
// func (h *Host) SubscribeGitRefsURL(cursor int64) string {
89
105
// scheme := "wss"
90
106
// if h.NoSSL {
···
98
114
// }
99
115
100
116
func (h *Host) LegacyEventsURL(cursor int64) string {
101
-
scheme := "wss"
102
-
if h.NoSSL {
103
-
scheme = "ws"
104
-
}
105
-
u := fmt.Sprintf("%s://%s/events", scheme, h.Hostname)
117
+
u := fmt.Sprintf("%s/events", h.WsURL())
106
118
if cursor > 0 {
107
119
u = fmt.Sprintf("%s?cursor=%d", u, cursor)
108
120
}
+17
-2
knotmirror/tapclient.go
+17
-2
knotmirror/tapclient.go
···
8
8
"log/slog"
9
9
"net/netip"
10
10
"net/url"
11
+
"strings"
11
12
"time"
12
13
13
14
"tangled.org/core/api/tangled"
···
78
79
return fmt.Errorf("parsing record: %w", err)
79
80
}
80
81
82
+
knotUrl := record.Knot
83
+
if !strings.Contains(record.Knot, "://") {
84
+
if host, _ := db.GetHost(ctx, t.db, record.Knot); host != nil {
85
+
knotUrl = host.URL()
86
+
} else {
87
+
t.logger.Warn("repo is from unknown knot")
88
+
if t.cfg.KnotUseSSL {
89
+
knotUrl = "https://" + knotUrl
90
+
} else {
91
+
knotUrl = "http://" + knotUrl
92
+
}
93
+
}
94
+
}
95
+
81
96
status := models.RepoStatePending
82
97
errMsg := ""
83
-
u, err := url.Parse("http://" + record.Knot) // parsing with fake scheme
98
+
u, err := url.Parse(knotUrl)
84
99
if err != nil {
85
100
status = models.RepoStateSuspended
86
101
errMsg = "failed to parse knot url"
···
94
109
Rkey: evt.Rkey,
95
110
Cid: evt.CID,
96
111
Name: record.Name,
97
-
KnotDomain: record.Knot,
112
+
KnotDomain: knotUrl,
98
113
State: status,
99
114
ErrorMsg: errMsg,
100
115
RetryAfter: 0, // clear retry info
History
7 rounds
0 comments
boltless.me
submitted
#6
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
2/3 timeout, 1/3 success
expand
collapse
expand 0 comments
pull request successfully merged
boltless.me
submitted
#5
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
2/3 timeout, 1/3 success
expand
collapse
expand 0 comments
boltless.me
submitted
#4
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
2/3 timeout, 1/3 success
expand
collapse
expand 0 comments
boltless.me
submitted
#3
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
2/3 failed, 1/3 success
expand
collapse
expand 0 comments
boltless.me
submitted
#2
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
expand 0 comments
boltless.me
submitted
#1
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>
expand 0 comments
boltless.me
submitted
#0
1 commit
expand
collapse
nix,knotmirror: listen & sync local knots from local knotmirror
Signed-off-by: Seongmin Lee <git@boltless.me>