Enhance XML parsing in index.html and add media management services to services.xml
This commit is contained in:
12
index.html
12
index.html
@@ -47,16 +47,26 @@
|
|||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const doc = parser.parseFromString(text, 'application/xml');
|
const doc = parser.parseFromString(text, 'application/xml');
|
||||||
|
|
||||||
|
// Check for XML parsing errors
|
||||||
|
const parseError = doc.querySelector('parsererror');
|
||||||
|
if(parseError){
|
||||||
|
throw new Error('XML parsing error: ' + parseError.textContent);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we have groups or just services
|
// Check if we have groups or just services
|
||||||
const groups = Array.from(doc.getElementsByTagName('group'));
|
const groups = Array.from(doc.getElementsByTagName('group'));
|
||||||
const hasGroups = groups.length > 0;
|
const hasGroups = groups.length > 0;
|
||||||
|
|
||||||
|
console.log('Found', groups.length, 'groups');
|
||||||
|
|
||||||
if(hasGroups){
|
if(hasGroups){
|
||||||
// Render grouped services
|
// Render grouped services
|
||||||
groups.forEach(group => {
|
groups.forEach(group => {
|
||||||
const groupName = group.getAttribute('name') || 'Services';
|
const groupName = group.getAttribute('name') || 'Services';
|
||||||
const services = Array.from(group.getElementsByTagName('service'));
|
const services = Array.from(group.getElementsByTagName('service'));
|
||||||
|
|
||||||
|
console.log('Group:', groupName, 'has', services.length, 'services');
|
||||||
|
|
||||||
if(services.length === 0) return;
|
if(services.length === 0) return;
|
||||||
|
|
||||||
// Create group section
|
// Create group section
|
||||||
@@ -310,7 +320,7 @@
|
|||||||
|
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.error(err);
|
console.error(err);
|
||||||
grid.innerHTML = '<p class="notes">Error loading services.xml — see console for details.</p>';
|
container.innerHTML = '<p class="notes">Error loading services.xml — see console for details.</p>';
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
11
services.xml
11
services.xml
@@ -39,7 +39,16 @@
|
|||||||
<service id="tdarr" name="Tdarr" proto="http" port="8265" logo="tdarr.svg" />
|
<service id="tdarr" name="Tdarr" proto="http" port="8265" logo="tdarr.svg" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group name="Storage & Files">
|
<group name="Media Management (*arr Stack)">
|
||||||
|
<service id="prowlarr" name="Prowlarr" proto="http" port="9696" logo="prowlarr.svg" />
|
||||||
|
<service id="sonarr" name="Sonarr" proto="http" port="8989" logo="sonarr.svg" />
|
||||||
|
<service id="radarr" name="Radarr" proto="http" port="7878" logo="radarr.svg" />
|
||||||
|
<service id="lidarr" name="Lidarr" proto="http" port="8686" logo="lidarr.svg" />
|
||||||
|
<service id="readarr" name="Readarr" proto="http" port="8787" logo="readarr.svg" />
|
||||||
|
<service id="bazarr" name="Bazarr" proto="http" port="6767" logo="bazarr.svg" />
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Storage & Files">
|
||||||
<service id="nextcloud" name="Nextcloud" proto="http" port="8080" logo="nextcloud.svg" host="cloud.spatulaa.com" />
|
<service id="nextcloud" name="Nextcloud" proto="http" port="8080" logo="nextcloud.svg" host="cloud.spatulaa.com" />
|
||||||
<service id="filebrowser" name="FileBrowser" proto="http" port="8986" logo="filebrowser.svg" />
|
<service id="filebrowser" name="FileBrowser" proto="http" port="8986" logo="filebrowser.svg" />
|
||||||
<service id="picoshare" name="Picoshare" proto="http" port="4001" logo="picoshare.svg" />
|
<service id="picoshare" name="Picoshare" proto="http" port="4001" logo="picoshare.svg" />
|
||||||
|
|||||||
Reference in New Issue
Block a user