mirror of
https://github.com/p1neappleXpress/OpenFlux.git
synced 2026-10-02 05:04:39 +08:00
main: keep the cupsonline room list out of the KDF context
The room list is created by the exit when it starts and handed to clients as --cupsonline-url, so the client derived the context from it while the exit, which has no URL, used "http://#": different keys and no handshake over real cups.online in --transports mode. It is skipped like a missing URL now, which is also what upstream exits derive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f62f1913a2
commit
bc9ada06f7
@@ -46,6 +46,11 @@ func TestPickSessionContext(t *testing.T) {
|
||||
{"highest-priority transport URL", "", "http://#", specs, "https://docs/doc"},
|
||||
{"no URL anywhere keeps the old default", "", "http://#", specs[:1], "http://#"},
|
||||
{"legacy single transport", "", "http://#", []transportSpec{{Type: "yandex", Priority: 100, URL: "http://#"}}, "http://#"},
|
||||
{"cupsonline rooms are not a context", "", "http://#", []transportSpec{
|
||||
{Type: "cupsonline", Priority: 100, URL: "WyIxYzE0NGQwZS1lMDQw"},
|
||||
{Type: "yandex", Priority: 50, URL: "https://docs/doc"},
|
||||
}, "https://docs/doc"},
|
||||
{"cupsonline alone", "", "http://#", []transportSpec{{Type: "cupsonline", Priority: 100, URL: "WyIxYzE0NGQwZS1lMDQw"}}, "http://#"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := pickSessionContext(c.explicit, c.url, c.specs); got != c.want {
|
||||
|
||||
@@ -144,9 +144,14 @@ func isNumber(s string) bool {
|
||||
//
|
||||
// explicit --session-context, if non-empty
|
||||
// --url globalURL, if set and not the placeholder
|
||||
// transports URL of the highest-priority transport that has one
|
||||
// transports URL of the highest-priority transport that has one,
|
||||
// cupsonline aside
|
||||
// fallback the placeholder "http://#"
|
||||
//
|
||||
// A cupsonline "URL" is the room list the exit creates when it starts and
|
||||
// prints for clients, so the exit cannot know it beforehand; letting it
|
||||
// into the context gave the two sides different keys.
|
||||
//
|
||||
// This is what the OpenFlux-Android client derives for a Session profile,
|
||||
// and the fallback is what older builds used whenever --url was unset, so a
|
||||
// node without any document URL (direct, oneme) keeps its old key.
|
||||
@@ -160,7 +165,10 @@ func pickSessionContext(explicit, globalURL string, specs []transportSpec) strin
|
||||
}
|
||||
best := -1
|
||||
for i, s := range specs {
|
||||
if s.URL != "" && s.URL != placeholder && (best < 0 || s.Priority > specs[best].Priority) {
|
||||
if s.Type == "cupsonline" || s.URL == "" || s.URL == placeholder {
|
||||
continue
|
||||
}
|
||||
if best < 0 || s.Priority > specs[best].Priority {
|
||||
best = i
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user