mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 00:56:16 +00:00
initializeDefaultSources() called GetDefaultSources(), which includes the legacy INTERNET_RADIO stub (ID 10002). On every service start it would re-add that entry to any device whose Sources.xml had it removed — including devices where the stale_internet_radio health-check quick fix was applied — silently undoing the clean-up. getAccountSources() in marge.go had the same issue: it passed the full default list into the /full cloud response, causing a phantom "sources_xml_diff" Info finding after a clean-up. Fix: export the existing private getInitialSources() as GetInitialSources() (excludes INTERNET_RADIO) and use it in both call sites instead of GetDefaultSources(). Existing devices that still have INTERNET_RADIO in their Sources.xml are unaffected: the merge loop only appends entries that are missing, so a present entry is preserved (the token is refreshed as before). Update unit and integration test expectations accordingly: the no-device fallback now returns 3 cloud sources (LOCAL_INTERNET_RADIO, TUNEIN, RADIO_BROWSER) instead of 4 (dropping INTERNET_RADIO / ID 10002). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
2.8 KiB
HTTP
54 lines
2.8 KiB
HTTP
### GET /streaming/account/{accountId}/sources
|
|
GET {{host}}/streaming/account/{{accountId}}/sources
|
|
Accept: application/vnd.bose.streaming-v1.1+xml
|
|
Authorization: Bearer dummy-token
|
|
|
|
> {%
|
|
client.test("Response is 200 OK", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
});
|
|
|
|
client.test("Content-Type is correct", function() {
|
|
client.assert(response.contentType.mimeType === "application/vnd.bose.streaming-v1.1+xml", "Wrong content type");
|
|
});
|
|
|
|
client.test("Response is XML and contains sources", function() {
|
|
const doc = response.body;
|
|
const sources = doc.documentElement;
|
|
client.assert(sources.nodeName === "sources", "Root element is not 'sources'");
|
|
|
|
const sourceList = sources.getElementsByTagName("source");
|
|
client.assert(sourceList.length >= 3, "Expected at least 3 source elements, found " + sourceList.length);
|
|
|
|
// AUX (id=10001, sourceproviderid=9) is intentionally excluded from
|
|
// cloud responses — real Bose never emitted AUX in /full or /sources;
|
|
// the speaker enumerates AUX from its own hardware via isLocal=true
|
|
// in :8090/sources. See pkg/service/marge/marge.go getAccountSources
|
|
// and commit 2b40481 (#195/#269).
|
|
// INTERNET_RADIO (id=10002) is also excluded — it is a legacy stub
|
|
// that AfterTouch no longer adds to new or existing devices. See
|
|
// GetInitialSources() in pkg/service/datastore/datastore.go.
|
|
const expectedIds = ["10003", "10004", "10005"];
|
|
for (let i = 0; i < sourceList.length; i++) {
|
|
const source = sourceList.item(i);
|
|
const sourceId = source.getAttribute("id");
|
|
client.assert(sourceId !== "10001", "Cloud /sources must not include AUX (id=10001)");
|
|
if (i < expectedIds.length) {
|
|
client.assert(sourceId === expectedIds[i], "Wrong source ID at index " + i + ": got " + sourceId + ", want " + expectedIds[i]);
|
|
}
|
|
client.assert(source.getAttribute("type") === "Audio", "Wrong source type for source " + sourceId);
|
|
|
|
const credentials = source.getElementsByTagName("credential");
|
|
client.assert(credentials.length > 0, "Missing credential for source " + sourceId);
|
|
const credential = credentials.item(0);
|
|
client.assert(credential.getAttribute("type").startsWith("token"), "Wrong credential type for source " + sourceId);
|
|
|
|
const expectedChildren = ["createdOn", "updatedOn", "name", "sourceproviderid", "sourcename", "sourceSettings", "username"];
|
|
expectedChildren.forEach(childName => {
|
|
const children = source.getElementsByTagName(childName);
|
|
client.assert(children.length > 0, "Missing " + childName + " for source " + sourceId);
|
|
});
|
|
}
|
|
});
|
|
%}
|