This commit is contained in:
Jade Macho 2024-01-07 04:47:57 +01:00
commit f913eb9b69
Signed by: 0x0ade
GPG Key ID: 21C91DB3ADE0B6D5
7 changed files with 1414 additions and 0 deletions

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# Frairable
Free your Airable-hindered Frontier Smart radio, at least somewhat.
## What? Why?
Some newer radios (you know, those boxes with speakers and antennas playing music) built around Frontier Smart no longer use the Frontier Nuvola services, and thus sadly, [KIMB-technologies/Radio-API](https://github.com/KIMB-technologies/Radio-API) no longer works with them. Instead, they seem to use [airable.wifiradiofrontier.com](https://airable.wifiradiofrontier.com/), which comes with its own quirks:
- Devices no longer "log in" the old way and don't expose an unique ID.
- Every request uses a fresh authorization header.
- You may have been struck by a 403 while trying to access that Airable link. Say goodbye to sniffing around on your own, and goodbye to replaying requests easily!
- Marking stations as favs and adding new stations is now handled on the device itself, instead of being handled by the server.
- API requests are performed through HTTPS (port 443) instead of HTTP (port 80)...
- ... yet (at least with the device I own,) you can throw any certificate at the device and it will eat it up. **MITM ahoy!**
This repo contains a single php file that sits in between your radio and the Airable API, adding new menu entries to the server's responses.
## How can I use this?
The way I've set it up on my Raspberry Pi 4b is absolutely cursed and there's certainly better ways to do it, but it's 04:34am as I'm clacking my keys right now and I want sleep, so here's my setup:
- Home Assistant OS
- Yes, I know running custom software outside of addons (which are just neatly packaged docker containers with special rules) isn't supported, but if it works in such a restrictive environment, then it surely works everywhere.
- [linuxserver/nginx](https://docs.linuxserver.io/images/docker-nginx/)
- Easy to set up, supports a wide range of platforms, and I don't need any of the fancyness that comes with linuxserver/swag (certbot) as it sits in my local network.
- The default config uses `index.php` for all requests, which is exactly what we want! Yay!
- Plop `index.php` and the `radios` dir into `www` (or set up a mount for it).
- In your favourite DNS adblocker (Pi-hole or AdGuard Home), redirect `airable.wifiradiofrontier.com` to your device's IP.
- Put a web radio into the radios dir (using my existing config as an example), or create your own:
- [Icecast](https://icecast.org/) or another web radio server
- I'm personally using [AzuraCast](https://www.azuracast.com/), which uses Icecast under the hood, but with arm64 support!
- [butt](https://danielnoethen.de/butt/)
- This is really just if you want to f.e. stream your PC audio to your internet radio.
- ???
- Profit!
**TL;DR: Set up a web server on ports 80 and 443, make it use `index.php` for every request, play around with the `radios` folder.**
## Any hints for following your footsteps?
- `mitmweb --set connection_strategy=lazy --ssl-insecure --mode reverse:https://airable.wifiradiofrontier.com@443`
- The dumps folder contains some things which might get useful if Airable ever goes down / if anyone wants to come up with a fully self-hosted replacement.

857
dumps/listing.json Normal file
View File

@ -0,0 +1,857 @@
{
"content": {
"entries": [
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"3902647967915982"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/39/02/647967915982.png"
}
],
"title": "radio x",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"5453212446998805"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/54/53/212446998805.png"
}
],
"title": "hr1 Südhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/5453212446998805"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"7179445401765407"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/71/79/445401765407.png"
}
],
"title": "LUX Radio",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7179445401765407"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"5560102310962976"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/55/60/102310962976.png"
}
],
"title": "hr1 Rhein-Main",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/5560102310962976"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"9411846389062704"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/94/11/846389062704.png"
}
],
"title": "hr3 Mittelhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/9411846389062704"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"4585727038793266"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/45/85/727038793266.png"
}
],
"title": "hr1 Osthessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/4585727038793266"
},
{
"contains": [
"networks"
],
"id": [
"frontiersmart",
"radio",
"1677345132455229"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/16/77/345132455229.png"
}
],
"title": "Radio Holiday",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1677345132455229"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"1501242486760020"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/15/01/242486760020.png"
}
],
"title": "hr3 Südhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1501242486760020"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"3705006928183138"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/37/05/006928183138.png"
}
],
"title": "hr3 Osthessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3705006928183138"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"8935428941156716"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/89/35/428941156716.png"
}
],
"title": "hr3 Nordhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8935428941156716"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"2321126383729279"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/23/21/126383729279.png"
}
],
"title": "hr1 Nordhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/2321126383729279"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"4538698300719261"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/45/38/698300719261.png"
}
],
"title": "JOKE FM",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/4538698300719261"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"5021071908064187"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/50/21/071908064187.png"
}
],
"title": "hr3 Rhein-Main",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/5021071908064187"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"1765705910976976"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/17/65/705910976976.png"
}
],
"title": "hr2-kultur",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1765705910976976"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"3304502407554537"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/33/04/502407554537.png"
}
],
"title": "hr1 Mittelhessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3304502407554537"
},
{
"contains": [
"feeds",
"networks"
],
"id": [
"frontiersmart",
"radio",
"7067940294276924"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/70/67/940294276924.png"
}
],
"title": "hr-iNFO",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7067940294276924"
},
{
"contains": [
"feeds",
"networks"
],
"id": [
"frontiersmart",
"radio",
"7840823863632978"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/78/40/823863632978.png"
}
],
"title": "YOU FM",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7840823863632978"
},
{
"contains": [
"networks"
],
"id": [
"frontiersmart",
"radio",
"7555155485868455"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/75/55/155485868455.png"
}
],
"title": "Radio Frankfurt",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7555155485868455"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"8371363792568446"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/83/71/363792568446.png"
}
],
"title": "planet radio",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8371363792568446"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"8235739264171571"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/82/35/739264171571.png"
}
],
"title": "80er-Radio harmony",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8235739264171571"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"7886892316397280"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/78/86/892316397280.png"
}
],
"title": "HIT RADIO FFH",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7886892316397280"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"7007365084718914"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/70/07/365084718914.png"
}
],
"title": "Metropol FM Hessen",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/7007365084718914"
},
{
"contains": [
"feeds"
],
"id": [
"frontiersmart",
"radio",
"8699162444565446"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/86/99/162444565446.png"
}
],
"title": "Radio Darmstadt",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8699162444565446"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"9186180690769107"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/91/86/180690769107.png"
}
],
"title": "Radio Rüsselsheim",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/9186180690769107"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"3817837357055396"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/38/17/837357055396.png"
}
],
"title": "Radio Welle West Wetterau",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3817837357055396"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"6715799686033279"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/67/15/799686033279.png"
}
],
"title": "Antenne Bergstraße",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/6715799686033279"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"9404374986886979"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/94/04/374986886979.png"
}
],
"title": "Rockland Radio DAB",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/9404374986886979"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"2431844086851924"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/24/31/844086851924.png"
}
],
"title": "Metropol FM Rhein-Main",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/2431844086851924"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"1511868866626173"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/15/11/868866626173.png"
}
],
"title": "bigFM Rheinland-Pfalz",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1511868866626173"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"8891575418878348"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/88/91/575418878348.png"
}
],
"title": "RPR1. Mainz",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8891575418878348"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"2656427727546543"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/26/56/427727546543.png"
}
],
"title": "Antenne Mainz 106,6",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/2656427727546543"
},
{
"contains": [
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"8867995075881482"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/88/67/995075881482.png"
}
],
"title": "AFN Go Wiesbaden",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/8867995075881482"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"3856596827972680"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/38/56/596827972680.png"
}
],
"title": "Radio Rheinwelle",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3856596827972680"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"3026217350736260"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/30/26/217350736260.png"
}
],
"title": "Rockland Radio Mainz",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3026217350736260"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"1770918067544698"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/17/70/918067544698.png"
}
],
"title": "SWR4 Rheinland-Pfalz",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1770918067544698"
},
{
"contains": [
"feeds",
"networks",
"radios"
],
"id": [
"frontiersmart",
"radio",
"5113015723880381"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/51/13/015723880381.png"
}
],
"title": "SWR1 Rheinland-Pfalz",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/5113015723880381"
},
{
"contains": [],
"id": [
"frontiersmart",
"radio",
"4300495584495366"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/43/00/495584495366.png"
}
],
"title": "Radio Primavera",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/4300495584495366"
},
{
"contains": [
"radios"
],
"id": [
"frontiersmart",
"radio",
"1546242184005677"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/15/46/242184005677.png"
}
],
"title": "Radio Galaxy Aschaffenburg",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/1546242184005677"
}
]
},
"id": [
"frontiersmart",
"directory",
"local"
],
"title": "Local stations",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radios/local"
}

109
dumps/meta.json Normal file
View File

@ -0,0 +1,109 @@
{
"description": "radio x ist das werbefreie und nichtkommerzielle Stadtradio in Frankfurt am Main.",
"genres": [
{
"id": [
"frontiersmart",
"genre",
"9543168084230275"
],
"title": "Freeform-Eclectic"
}
],
"id": [
"frontiersmart",
"radio",
"3902647967915982"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/39/02/647967915982.png"
}
],
"language": {
"id": [
"frontiersmart",
"language",
"5287211298011244"
],
"iso": "deu",
"title": "German"
},
"origin": {
"city": {
"id": [
"frontiersmart",
"place",
"9919585529714824"
],
"title": "Frankfurt am Main",
"type": "city"
},
"continent": {
"id": [
"frontiersmart",
"place",
"6367601698730142"
],
"title": "Europe",
"type": "continent"
},
"country": {
"id": [
"frontiersmart",
"place",
"8777677923440934"
],
"iso": "de",
"title": "Germany",
"type": "country"
},
"state": {
"id": [
"frontiersmart",
"place",
"2003820068202912"
],
"title": "Hesse",
"type": "state"
}
},
"place": {
"id": [
"frontiersmart",
"place",
"9919585529714824"
],
"title": "Frankfurt am Main",
"type": "city"
},
"streams": [
{
"codec": {
"bitrate": 128,
"channels": 2,
"name": "MP3",
"samplerate": 44.1
},
"reliability": 0.99,
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982/play/5973324663937092"
},
{
"codec": {
"bitrate": 64,
"channels": 2,
"name": "AAC",
"samplerate": 44.1
},
"reliability": 0.99,
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982/play/5448981903493405"
}
],
"title": "radio x",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982"
}

140
dumps/play.json Normal file
View File

@ -0,0 +1,140 @@
{
"codec": {
"bitrate": 128,
"channels": 2,
"name": "MP3",
"samplerate": 44.1
},
"content": {
"description": "radio x ist das werbefreie und nichtkommerzielle Stadtradio in Frankfurt am Main.",
"genres": [
{
"id": [
"frontiersmart",
"genre",
"9543168084230275"
],
"title": "Freeform-Eclectic"
}
],
"id": [
"frontiersmart",
"radio",
"3902647967915982"
],
"images": [
{
"size": [
150,
150
],
"type": "cover",
"url": "http://airableassets-cdn.wifiradiofrontier.com/png@150x150/39/02/647967915982.png"
}
],
"language": {
"id": [
"frontiersmart",
"language",
"5287211298011244"
],
"iso": "deu",
"title": "German"
},
"origin": {
"city": {
"id": [
"frontiersmart",
"place",
"9919585529714824"
],
"title": "Frankfurt am Main",
"type": "city"
},
"continent": {
"id": [
"frontiersmart",
"place",
"6367601698730142"
],
"title": "Europe",
"type": "continent"
},
"country": {
"id": [
"frontiersmart",
"place",
"8777677923440934"
],
"iso": "de",
"title": "Germany",
"type": "country"
},
"state": {
"id": [
"frontiersmart",
"place",
"2003820068202912"
],
"title": "Hesse",
"type": "state"
}
},
"place": {
"id": [
"frontiersmart",
"place",
"9919585529714824"
],
"title": "Frankfurt am Main",
"type": "city"
},
"streams": [
{
"codec": {
"bitrate": 128,
"channels": 2,
"name": "MP3",
"samplerate": 44.1
},
"reliability": 0.99,
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982/play/5973324663937092"
},
{
"codec": {
"bitrate": 64,
"channels": 2,
"name": "AAC",
"samplerate": 44.1
},
"reliability": 0.99,
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982/play/5448981903493405"
}
],
"title": "radio x",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radio/3902647967915982"
},
"events": {
"error": {
"url": "https://airable.wifiradiofrontier.com/frontiersmart/metrics/WyJlcnJvciIsInJhZGlvIiwiT0daY3h0TUhCRkZOZDJuWGN5a21GZEtKREs5SHJIa0QiLCIzOTAyNjQ3OTY3OTE1OTgyIiwiNTk3MzMyNDY2MzkzNzA5MiJd"
},
"play": {
"url": "https://airable.wifiradiofrontier.com/frontiersmart/metrics/WyJwbGF5IiwicmFkaW8iLCJPR1pjeHRNSEJGRk5kMm5YY3lrbUZkS0pESzlIckhrRCIsIjM5MDI2NDc5Njc5MTU5ODIiLCI1OTczMzI0NjYzOTM3MDkyIl0"
},
"playing": {
"attributes": [
"stream_title"
],
"url": "https://airable.wifiradiofrontier.com/frontiersmart/metrics/WyJwbGF5aW5nIiwicmFkaW8iLCJPR1pjeHRNSEJGRk5kMm5YY3lrbUZkS0pESzlIckhrRCIsIjM5MDI2NDc5Njc5MTU5ODIiLCI1OTczMzI0NjYzOTM3MDkyIl0"
},
"stop": {
"url": "https://airable.wifiradiofrontier.com/frontiersmart/metrics/WyJzdG9wIiwicmFkaW8iLCJPR1pjeHRNSEJGRk5kMm5YY3lrbUZkS0pESzlIckhrRCIsIjM5MDI2NDc5Njc5MTU5ODIiLCI1OTczMzI0NjYzOTM3MDkyIl0"
}
},
"id": [
"frontiersmart",
"redirect",
"qErGF6QRsXTC0S0zFPQ9ezwfNXaLSEdG"
],
"url": "http://radiox.istmein.de:8000/live"
}

24
dumps/search.json Normal file
View File

@ -0,0 +1,24 @@
{
"buttons": {
"submit": {
"title": "Search",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radios/search"
}
},
"description": "Enter Search Term",
"fields": {
"q": {
"description": "What are you looking for?",
"required": true,
"title": "Searching for:",
"type": "text"
}
},
"id": [
"frontiersmart",
"form",
"search"
],
"title": "Search",
"url": "https://airable.wifiradiofrontier.com/frontiersmart/radios/search"
}

218
index.php Normal file
View File

@ -0,0 +1,218 @@
<?php
$GLOBALS["frairable_host"] = getenv("FRAIRABLE_HOST");
if (empty($GLOBALS["frairable_host"])) {
$GLOBALS["frairable_host"] = "https://airable.wifiradiofrontier.com";
}
$GLOBALS["frairable_dir_radios"] = getenv("FRAIRABLE_DIR_RADIOS");
if (empty($GLOBALS["frairable_dir_radios"])) {
$GLOBALS["frairable_dir_radios"] = dirname(__FILE__) . DIRECTORY_SEPARATOR . "radios";
}
function respond_with_raw(&$data) {
ob_start();
{
ob_start("ob_data");
{
echo($data);
ob_end_flush();
}
header("Content-Length: " . ob_get_length());
ob_end_flush();
}
}
function respond_with_json(&$data) {
header("Content-Type: application/json");
ob_start();
{
ob_start("ob_data");
{
echo(json_encode($data));
ob_end_flush();
}
header("Content-Length: " . ob_get_length());
ob_end_flush();
}
}
function airable_proxy($cb = NULL) {
$ch = curl_init("$GLOBALS[frairable_host]$_SERVER[REQUEST_URI]");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $_SERVER["REQUEST_METHOD"]);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
$headers_req = getallheaders();
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: " . ($headers_req["Accept"] ?? "audio/aac;mp3;dash"),
"Accept-Language: " . ($headers_req["Accept-Language"] ?? "en-US"),
"Authorization: " . ($headers_req["Authorization"] ?? "true"),
"Connection: " . ($headers_req["Connection"] ?? "Close"),
"Content-Length: " . ($headers_req["Content-Length"] ?? "0"),
"User-Agent: " . ($headers_req["User-Agent"] ?? "ir-cui-FS2340-0000-0165_V4.5.13.707296-1A17")
]);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $headerstr) {
$len = strlen($headerstr);
$header = explode(":", $headerstr, 2);
if (count($header) < 2) {
return $len;
}
$key = trim($header[0]);
$value = trim($header[1]);
if ($key !== "Content-Length") {
header($headerstr);
}
return $len;
});
$data = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
http_response_code($httpCode);
if ($_SERVER["REQUEST_METHOD"] === "GET" && $httpCode === 200) {
if ($cb !== NULL) {
$data = json_decode($data, true);
$cb($data);
$data = json_encode($data);
}
if ($data === "null") {
$data = "";
if (200 <= $httpCode && $httpCode < 300) {
http_response_code(404);
}
}
}
respond_with_raw($data);
}
function get_radio_data($id) {
$path = $GLOBALS["frairable_dir_radios"] . DIRECTORY_SEPARATOR . $id . ".json";
$path = realpath($path);
if (!str_starts_with($path, dirname(__FILE__))) {
http_response_code(400);
die();
}
return json_decode(file_get_contents($path), true);
}
function get_radio_entry($id) {
$data = get_radio_data($id);
$data["contains"] = [];
$data["id"] = ["frontiersmart", "radio", "custom=$id"];
$data["url"] = "$GLOBALS[frairable_host]/frontiersmart/radio/custom=$id";
unset($data["streams"]);
return $data;
}
function get_radio_meta($id) {
$data = get_radio_data($id);
$data["id"] = ["frontiersmart", "radio", "custom=$id"];
$data["url"] = "$GLOBALS[frairable_host]/frontiersmart/radio/custom=$id";
foreach ($data["streams"] as $index => &$stream) {
$stream["url"] = "$GLOBALS[frairable_host]/frontiersmart/radio/custom=$id/play=$index";
}
return $data;
}
function get_radio_play($id, $index) {
$data = get_radio_data($id);
// clone loves to complain about the stream not being an object...
// deep clone using json is ugly, but eh.
$stream = json_decode(json_encode($data["streams"][$index]), true);
$stream["id"] = ["frontiersmart", "redirect", "custom=$id/play=$index"];
$stream["content"] = $data;
unset($stream["reliability"]);
return $stream;
}
if ($_SERVER["REQUEST_URI"] === "/frontiersmart/radios") {
airable_proxy(function(&$data) {
array_push($data["content"]["entries"], [
"id" => [
"frontiersmart",
"directory",
"custom"
],
"title" => "Frairable (Custom)",
"url" => "$GLOBALS[frairable_host]/frontiersmart/radios/custom"
]);
});
} elseif ($_SERVER["REQUEST_URI"] === "/frontiersmart/radios/custom") {
$entries = [];
foreach (new DirectoryIterator($GLOBALS["frairable_dir_radios"]) as $sub) {
if ($sub->isDot() || $sub->isDir()) {
continue;
}
$id = basename($sub->getFilename(), ".json");
$entries[] = get_radio_entry($id);
}
$data = [
"id" => [
"frontiersmart",
"directory",
"custom"
],
"title" => "Frairable (Custom)",
"url" => "$GLOBALS[frairable_host]$_SERVER[REQUEST_URI]",
"content" => [
"entries" => $entries
]
];
respond_with_json($data);
} elseif (str_starts_with($_SERVER["REQUEST_URI"], "/frontiersmart/radio/custom=")) {
$id = substr($_SERVER["REQUEST_URI"], strlen("/frontiersmart/radio/custom="));
$split = strpos($id, "/play=");
if ($split) {
$index = intval(substr($id, $split + strlen("/play=")));
$id = substr($id, 0, $split);
respond_with_json(get_radio_play($id, $index));
} else {
respond_with_json(get_radio_meta($id));
}
} else {
airable_proxy();
}
?>

28
radios/desktop.json Normal file
View File

@ -0,0 +1,28 @@
{
"title": "ade-main-win",
"description": "desktop audio stream",
"images": [
{
"size": [
292,
404
],
"type": "cover",
"url": "http://toriel.0x0a.de/toriel.png"
}
],
"streams": [
{
"codec": {
"bitrate": 320,
"channels": 2,
"name": "MP3",
"samplerate": 48
},
"reliability": 0.99,
"url": "http://icecast.toriel.0x0a.de/desktop.mp3"
}
]
}