From 38f8527a82ed9b90e5161c31f4e987d659913639 Mon Sep 17 00:00:00 2001 From: "Buster \"Silver Eagle\" Neece" Date: Thu, 27 Sep 2018 12:29:05 -0500 Subject: [PATCH] Remove SHOUTcast in default installations and provide a manual installer in the admin UI. --- bootstrap/app.php | 2 + config/admin/dashboard.php | 7 +- config/forms/install_shoutcast.php | 38 ++++ config/forms/station.php | 4 +- config/routes.php | 7 + docker-compose.dev.yml | 17 +- docker-compose.sample.yml | 7 +- resources/locale/default.pot | 177 +++++++++++------- .../admin/install_shoutcast/installed.phtml | 11 ++ .../Admin/Install/ShoutcastController.php | 70 +++++++ src/Plugins.php | 1 + src/Provider/AdminProvider.php | 9 + src/Radio/Adapters.php | 12 +- src/Radio/Frontend/SHOUTcast.php | 7 +- .../roles/azuracast-radio/tasks/x86.yml | 22 --- util/docker/testing/Dockerfile | 5 + util/docker/web/Dockerfile | 9 + 17 files changed, 297 insertions(+), 108 deletions(-) create mode 100644 config/forms/install_shoutcast.php create mode 100644 resources/templates/admin/install_shoutcast/installed.phtml create mode 100644 src/Controller/Admin/Install/ShoutcastController.php create mode 100644 util/docker/web/Dockerfile diff --git a/bootstrap/app.php b/bootstrap/app.php index a2e44e314..df276c0fe 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -39,6 +39,8 @@ if (APP_INSIDE_DOCKER) { define('APP_APPLICATION_ENV', $_ENV['application_env'] ?? $_ENV['APPLICATION_ENV'] ?? 'production'); define('APP_IN_PRODUCTION', APP_APPLICATION_ENV === 'production'); +define('APP_DOCKER_REVISION', $_ENV['AZURACAST_DC_REVISION'] ?? 1); + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $_SERVER['HTTPS'] = (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https'); } diff --git a/config/admin/dashboard.php b/config/admin/dashboard.php index dc01ad3ad..e9fe4e07b 100644 --- a/config/admin/dashboard.php +++ b/config/admin/dashboard.php @@ -52,6 +52,11 @@ return [ 'icon' => 'zmdi zmdi-format-list-bulleted', 'permission' => 'administer custom fields', ], + __('Install SHOUTcast') => [ + 'url' => 'admin:install:shoutcast', + 'icon' => 'zmdi zmdi-upload', + 'permission' => 'administer all', + ], ], ], -]; \ No newline at end of file +]; diff --git a/config/forms/install_shoutcast.php b/config/forms/install_shoutcast.php new file mode 100644 index 000000000..cd3f37554 --- /dev/null +++ b/config/forms/install_shoutcast.php @@ -0,0 +1,38 @@ + 'post', + 'enctype' => 'multipart/form-data', + + 'elements' => [ + + 'details' => [ + 'markup', + [ + 'label' => __('Important Notes'), + 'markup' => __('

SHOUTcast 2 DNAS is not free software, and its restrictive license does not allow AzuraCast to distribute the SHOUTcast binary. In order to install SHOUTcast, you should download the Linux x64 binary from the SHOUTcast Radio Manager web site. Upload the sc_serv2_linux_x64-latest.tar.gz into the field below to automatically extract it into the proper directory.

', 'https://radiomanager.shoutcast.com/register/serverSoftwareFreemium'), + ] + ], + + 'binary' => [ + 'file', + [ + 'label' => __('Select SHOUTcast 64-bit .tar.gz File'), + 'required' => true, + 'type' => [ + 'application/x-gzip', + 'application/tar+gzip', + 'application/octet-stream', + ], + ] + ], + + 'submit' => [ + 'submit', + [ + 'type' => 'submit', + 'label' => __('Upload'), + 'class' => 'ui-button btn-lg btn-primary', + ] + ], + ], +]; diff --git a/config/forms/station.php b/config/forms/station.php index 94a22fa3e..df7569ddc 100644 --- a/config/forms/station.php +++ b/config/forms/station.php @@ -2,13 +2,13 @@ use App\Entity\Station; use App\Radio\Adapters; -$frontends = Adapters::listFrontendAdapters(); +$frontends = Adapters::listFrontendAdapters(true); $frontend_types = []; foreach ($frontends as $adapter_nickname => $adapter_info) { $frontend_types[$adapter_nickname] = $adapter_info['name']; } -$backends = Adapters::listBackendAdapters(); +$backends = Adapters::listBackendAdapters(true); $backend_types = []; foreach ($backends as $adapter_nickname => $adapter_info) { $backend_types[$adapter_nickname] = $adapter_info['name']; diff --git a/config/routes.php b/config/routes.php index c8b52b829..d2b6a32b8 100644 --- a/config/routes.php +++ b/config/routes.php @@ -14,6 +14,13 @@ return function(\Slim\App $app) ->setName('admin:index:sync') ->add([Middleware\Permissions::class, 'administer all']); + $this->group('/install', function () { + + $this->map(['GET', 'POST'], '/shoutcast', Controller\Admin\Install\ShoutcastController::class) + ->setName('admin:install:shoutcast'); + + })->add([Middleware\Permissions::class, 'administer all']); + $this->group('/api', function () { $this->get('', Controller\Admin\ApiController::class.':indexAction') diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index a0fa50461..15802e921 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -4,7 +4,7 @@ services: web: image: azuracast/azuracast_web:latest build: - context: ../docker-azuracast-web + context: ./util/docker/web depends_on: - mariadb - influxdb @@ -18,11 +18,12 @@ services: MYSQL_PASSWORD: "azur4c457" # ^ MYSQL_DATABASE: "azuracast" # ^ MYSQL_RANDOM_ROOT_PASSWORD: "yes" - AZURACAST_DC_REVISION: 2 # Only modified when this Docker Compose file has changed. + AZURACAST_DC_REVISION: 3 # Only modified when this Docker Compose file has changed. volumes: - .:/var/azuracast/www - tmp_data:/var/azuracast/www_tmp - station_data:/var/azuracast/stations + - shoutcast2_install:/var/azuracast/servers/shoutcast2 init: true restart: always @@ -121,9 +122,9 @@ services: stations: container_name: azuracast_stations - image: azuracast/azuracast_stations:latest + image: azuracast/azuracast_radio:latest build: - context: ../docker-azuracast-stations + context: ../docker-azuracast-radio ports: - '8000:8000' - '8005:8005' @@ -143,6 +144,7 @@ services: volumes: - station_data:/var/azuracast/stations - nginx_letsencrypt_certs:/etc/nginx/ssl:ro + - shoutcast2_install:/var/azuracast/servers/shoutcast2 init: true restart: always @@ -168,10 +170,17 @@ services: ports: - "127.0.0.1:8081:8081" + blackfire: + image: blackfire/blackfire + environment: + BLACKFIRE_SERVER_ID: "" + BLACKFIRE_SERVER_TOKEN: "" + volumes: nginx_letsencrypt_certs: {} nginx_letsencrypt_www: {} db_data: {} influx_data: {} station_data: {} + shoutcast2_install: {} tmp_data: {} diff --git a/docker-compose.sample.yml b/docker-compose.sample.yml index 3c79635b7..ddb9d97c3 100644 --- a/docker-compose.sample.yml +++ b/docker-compose.sample.yml @@ -16,11 +16,12 @@ services: MYSQL_PASSWORD: "azur4c457" # ^ MYSQL_DATABASE: "azuracast" # ^ MYSQL_RANDOM_ROOT_PASSWORD: "yes" - AZURACAST_DC_REVISION: 2 # Only modified when this Docker Compose file has changed. + AZURACAST_DC_REVISION: 3 # Only modified when this Docker Compose file has changed. volumes: - www_data:/var/azuracast/www - tmp_data:/var/azuracast/www_tmp - station_data:/var/azuracast/stations + - shoutcast2_install:/var/azuracast/servers/shoutcast2 init: true restart: always @@ -100,7 +101,7 @@ services: stations: container_name: azuracast_stations - image: azuracast/azuracast_stations:latest + image: azuracast/azuracast_radio:latest ports: # Uncomment the line below to expose the full range of available station ports. # Note: This is not recommended currently due to performance and memory usage problems with Docker. @@ -134,6 +135,7 @@ services: - '8096:8096' volumes: - station_data:/var/azuracast/stations + - shoutcast2_install:/var/azuracast/servers/shoutcast2 - nginx_letsencrypt_certs:/etc/nginx/ssl:ro init: true restart: always @@ -144,5 +146,6 @@ volumes: db_data: {} influx_data: {} station_data: {} + shoutcast2_install: {} www_data: {} tmp_data: {} diff --git a/resources/locale/default.pot b/resources/locale/default.pot index b51522efb..5ec284005 100644 --- a/resources/locale/default.pot +++ b/resources/locale/default.pot @@ -7,8 +7,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2018-09-11T04:40:33+00:00\n" -"PO-Revision-Date: 2018-09-11T04:40:33+00:00\n" +"POT-Creation-Date: 2018-09-27T17:24:43+00:00\n" +"PO-Revision-Date: 2018-09-27T17:24:43+00:00\n" "Language: \n" #: /var/azuracast/www/src/Controller/Admin/ApiController.php:54 @@ -76,7 +76,7 @@ msgstr "" #: /var/azuracast/www/src/Controller/Admin/UsersController.php:110 #: /var/azuracast/www/src/Controller/Frontend/ApiKeysController.php:118 #: /var/azuracast/www/src/Controller/Stations/MountsController.php:132 -#: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:419 +#: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:421 #: /var/azuracast/www/src/Controller/Stations/RemotesController.php:114 #: /var/azuracast/www/src/Controller/Stations/StreamersController.php:135 #: /var/azuracast/www/src/Controller/Stations/WebhooksController.php:219 @@ -141,6 +141,11 @@ msgstr "" msgid "Sync Task Output" msgstr "" +#: /var/azuracast/www/src/Controller/Admin/Install/ShoutcastController.php:67 +#: /var/azuracast/www/config/admin/dashboard.php:55 +msgid "Install SHOUTcast" +msgstr "" + #: /var/azuracast/www/src/Controller/Admin/PermissionsController.php:101 #: /var/azuracast/www/src/Controller/Admin/PermissionsController.php:109 #: /var/azuracast/www/src/Controller/Admin/PermissionsController.php:127 @@ -200,38 +205,38 @@ msgid "Logged in successfully." msgstr "" #: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:64 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:115 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:184 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:117 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:188 msgid "%s restarted." msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:96 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:102 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:115 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:98 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:104 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:117 msgid "Frontend" msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:96 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:165 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:98 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:169 msgid "%s stopped." msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:102 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:171 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:104 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:175 msgid "%s started." msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:151 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:155 msgid "Song skipped." msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:159 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:163 msgid "Streamer disconnected." msgstr "" -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:165 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:171 -#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:184 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:169 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:175 +#: /var/azuracast/www/src/Controller/Api/Stations/ServicesController.php:188 msgid "Backend" msgstr "" @@ -277,7 +282,7 @@ msgstr "" msgid "Edit Profile" msgstr "" -#: /var/azuracast/www/src/Controller/Frontend/PublicController.php:38 +#: /var/azuracast/www/src/Controller/Frontend/PublicController.php:37 msgid "Station not found!" msgstr "" @@ -352,7 +357,7 @@ msgstr "" #: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:223 #: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:303 #: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:310 -#: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:419 +#: /var/azuracast/www/src/Controller/Stations/PlaylistsController.php:421 #: /var/azuracast/www/resources/templates/frontend/public/index.phtml:46 #: /var/azuracast/www/resources/templates/stations/playlists/index.phtml:14 #: /var/azuracast/www/resources/templates/stations/playlists/index.phtml:15 @@ -382,8 +387,8 @@ msgstr "" #: /var/azuracast/www/config/forms/song.php:33 #: /var/azuracast/www/resources/templates/frontend/public/index.phtml:112 #: /var/azuracast/www/resources/templates/frontend/public/player_component.phtml:8 +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:26 #: /var/azuracast/www/resources/templates/stations/reports/timeline.phtml:40 -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:26 msgid "Song Title" msgstr "" @@ -404,6 +409,10 @@ msgstr "" msgid "Remote Relay" msgstr "" +#: /var/azuracast/www/src/Controller/Stations/Reports/SoundExchangeController.php:172 +msgid "SoundExchange Report" +msgstr "" + #: /var/azuracast/www/src/Controller/Stations/StreamersController.php:54 msgid "Streamers enabled!" msgstr "" @@ -463,17 +472,17 @@ msgstr "" msgid "You do not have permission to access this portion of the site." msgstr "" -#: /var/azuracast/www/src/Radio/Adapters.php:148 -#: /var/azuracast/www/src/Radio/Adapters.php:152 -#: /var/azuracast/www/src/Radio/Adapters.php:181 +#: /var/azuracast/www/src/Radio/Adapters.php:137 +#: /var/azuracast/www/src/Radio/Adapters.php:141 +#: /var/azuracast/www/src/Radio/Adapters.php:172 msgid "Use %s on this server" msgstr "" -#: /var/azuracast/www/src/Radio/Adapters.php:156 +#: /var/azuracast/www/src/Radio/Adapters.php:145 msgid "Connect to a remote radio server" msgstr "" -#: /var/azuracast/www/src/Radio/Adapters.php:185 +#: /var/azuracast/www/src/Radio/Adapters.php:176 msgid "Do not use an AutoDJ service" msgstr "" @@ -657,7 +666,7 @@ msgid "System Maintenance" msgstr "" #: /var/azuracast/www/config/admin/dashboard.php:15 -#: /var/azuracast/www/resources/templates/admin/branding/index.phtml:1 +#: /var/azuracast/www/resources/templates/admin/branding/index.phtml:8 msgid "Custom Branding" msgstr "" @@ -720,7 +729,7 @@ msgstr "" #: /var/azuracast/www/config/forms/station.php:62 #: /var/azuracast/www/config/forms/station.php:75 #: /var/azuracast/www/config/forms/station.php:107 -#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:51 +#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:47 #: /var/azuracast/www/resources/templates/stations/playlists/index.phtml:81 #: /var/azuracast/www/resources/templates/stations/profile/index.phtml:134 #: /var/azuracast/www/resources/templates/stations/profile/index.phtml:147 @@ -732,7 +741,7 @@ msgstr "" #: /var/azuracast/www/config/forms/automation.php:15 #: /var/azuracast/www/config/forms/station.php:63 #: /var/azuracast/www/config/forms/station.php:76 -#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:49 +#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:45 #: /var/azuracast/www/resources/templates/stations/profile/index.phtml:127 #: /var/azuracast/www/resources/templates/stations/profile/index.phtml:144 #: /var/azuracast/www/resources/templates/stations/remotes/index.phtml:42 @@ -901,6 +910,23 @@ msgstr "" msgid "Optionally specify an API-friendly name, such as field_name. Leave this field blank to automatically create one based on the name." msgstr "" +#: /var/azuracast/www/config/forms/install_shoutcast.php:11 +#: /var/azuracast/www/config/forms/report_soundexchange.php:10 +msgid "Important Notes" +msgstr "" + +#: /var/azuracast/www/config/forms/install_shoutcast.php:12 +msgid "

SHOUTcast 2 DNAS is not free software, and its restrictive license does not allow AzuraCast to distribute the SHOUTcast binary. In order to install SHOUTcast, you should download the Linux x64 binary from the SHOUTcast Radio Manager web site. Upload the sc_serv2_linux_x64-latest.tar.gz into the field below to automatically extract it into the proper directory.

" +msgstr "" + +#: /var/azuracast/www/config/forms/install_shoutcast.php:19 +msgid "Select SHOUTcast 64-bit .tar.gz File" +msgstr "" + +#: /var/azuracast/www/config/forms/install_shoutcast.php:33 +msgid "Upload" +msgstr "" + #: /var/azuracast/www/config/forms/login.php:9 #: /var/azuracast/www/config/forms/profile.php:24 #: /var/azuracast/www/config/forms/register.php:13 @@ -1218,7 +1244,7 @@ msgid "Play once per day at the specified time. Useful for timely reminders." msgstr "" #: /var/azuracast/www/config/forms/playlist.php:119 -#: /var/azuracast/www/resources/templates/system/form_page.js.phtml:37 +#: /var/azuracast/www/resources/templates/system/form_edit.js.phtml:43 msgid "Advanced" msgstr "" @@ -1483,10 +1509,6 @@ msgstr "" msgid "If you are broadcasting using AutoDJ, enter the source password here." msgstr "" -#: /var/azuracast/www/config/forms/report_soundexchange.php:10 -msgid "Important Notes" -msgstr "" - #: /var/azuracast/www/config/forms/report_soundexchange.php:38 msgid "Report Start Date" msgstr "" @@ -1522,7 +1544,7 @@ msgstr "" #: /var/azuracast/www/resources/templates/stations/playlists/index.phtml:38 #: /var/azuracast/www/resources/templates/stations/remotes/index.phtml:24 #: /var/azuracast/www/resources/templates/stations/reports/duplicates.phtml:23 -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:28 +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:28 #: /var/azuracast/www/resources/templates/stations/streamers/index.phtml:23 #: /var/azuracast/www/resources/templates/stations/webhooks/index.phtml:24 msgid "Actions" @@ -2065,10 +2087,10 @@ msgstr "" #: /var/azuracast/www/config/forms/webhook/generic.php:13 msgid "" -"Web hooks automatically send a HTTP POST request to the URL you specify to \n" -" notify it any time one of the triggers you specify occurs on your station. The body of the POST message\n" -" is the exact same as the Now Playing API response for your station. \n" -" In order to process quickly, web hooks have a short timeout, so the responding service should be\n" +"Web hooks automatically send a HTTP POST request to the URL you specify to \n" +" notify it any time one of the triggers you specify occurs on your station. The body of the POST message \n" +" is the exact same as the Now Playing API response for your station. \n" +" In order to process quickly, web hooks have a short timeout, so the responding service should be \n" " optimized to handle the request in under 2 seconds." msgstr "" @@ -2283,7 +2305,7 @@ msgstr "" #: /var/azuracast/www/resources/templates/stations/playlists/index.phtml:64 #: /var/azuracast/www/resources/templates/stations/remotes/index.phtml:35 #: /var/azuracast/www/resources/templates/stations/reports/duplicates.phtml:33 -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:53 +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:53 #: /var/azuracast/www/resources/templates/stations/streamers/index.phtml:35 #: /var/azuracast/www/resources/templates/stations/webhooks/index.phtml:37 msgid "Delete" @@ -2298,6 +2320,15 @@ msgstr "" msgid "%s ago" msgstr "" +#: /var/azuracast/www/resources/templates/admin/install_shoutcast/installed.phtml:1 +#: /var/azuracast/www/resources/templates/admin/install_shoutcast/installed.phtml:5 +msgid "SHOUTcast is Installed" +msgstr "" + +#: /var/azuracast/www/resources/templates/admin/install_shoutcast/installed.phtml:9 +msgid "The SHOUTcast 2 DNAS is already installed." +msgstr "" + #: /var/azuracast/www/resources/templates/admin/permissions/index.phtml:24 msgid "Per-Station Permissions" msgstr "" @@ -2567,24 +2598,24 @@ msgstr "" msgid "Pause" msgstr "" -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:1 -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:4 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:2 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:6 msgid "Automated Playlist Assignment" msgstr "" -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:7 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:9 msgid "Based on the previous performance of your station's songs, %s can automatically distribute songs evenly among your playlists, placing the highest performing songs in the highest-weighted playlists." msgstr "" -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:9 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:11 msgid "Once you have configured automated assignment, click the button below to run the automated assignment process. This process will not run at all unless you have selected \"Enable\" below." msgstr "" -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:11 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:13 msgid "Run Automated Assignment" msgstr "" -#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:17 +#: /var/azuracast/www/resources/templates/stations/automation/index.phtml:19 msgid "Configure Automated Assignment" msgstr "" @@ -2758,7 +2789,7 @@ msgstr "" msgid "AutoDJ" msgstr "" -#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:44 +#: /var/azuracast/www/resources/templates/stations/mounts/index.phtml:40 msgid "Default Mount" msgstr "" @@ -2864,8 +2895,8 @@ msgid "Disconnect Streamer" msgstr "" #: /var/azuracast/www/resources/templates/stations/profile/index.phtml:124 -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:1 -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:11 +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:1 +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:11 #: /var/azuracast/www/resources/templates/stations/sidebar.phtml:83 msgid "Song Requests" msgstr "" @@ -3092,6 +3123,22 @@ msgstr "" msgid "Ratio" msgstr "" +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:24 +msgid "Date Requested" +msgstr "" + +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:25 +msgid "Date Played" +msgstr "" + +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:27 +msgid "Requester IP" +msgstr "" + +#: /var/azuracast/www/resources/templates/stations/reports/requests.phtml:39 +msgid "Not Played" +msgstr "" + #: /var/azuracast/www/resources/templates/stations/reports/restricted.phtml:1 #: /var/azuracast/www/resources/templates/stations/reports/restricted.phtml:5 msgid "Report Not Available" @@ -3123,22 +3170,6 @@ msgstr "" msgid "Live Broadcast" msgstr "" -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:24 -msgid "Date Requested" -msgstr "" - -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:25 -msgid "Date Played" -msgstr "" - -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:27 -msgid "Requester IP" -msgstr "" - -#: /var/azuracast/www/resources/templates/stations/requests/index.phtml:39 -msgid "Not Played" -msgstr "" - #: /var/azuracast/www/resources/templates/stations/sidebar.phtml:19 msgid "Ready to Broadcast?
Click to Start Station" msgstr "" @@ -3167,19 +3198,23 @@ msgstr "" msgid "Duplicate Songs" msgstr "" -#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:95 +#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:91 +msgid "SoundExchange Royalties" +msgstr "" + +#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:98 msgid "Utilities" msgstr "" -#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:99 +#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:102 msgid "Automated Assignment" msgstr "" -#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:102 +#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:105 msgid "Restart Broadcasting" msgstr "" -#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:117 +#: /var/azuracast/www/resources/templates/stations/sidebar.phtml:120 msgid "Please wait..." msgstr "" @@ -3269,11 +3304,11 @@ msgstr "" msgid "Test" msgstr "" -#: /var/azuracast/www/resources/templates/system/form_page.js.phtml:50 -#: /var/azuracast/www/resources/templates/system/form_page.js.phtml:51 +#: /var/azuracast/www/resources/templates/system/form_edit.js.phtml:13 +#: /var/azuracast/www/resources/templates/system/form_edit.js.phtml:14 msgid "Select..." msgstr "" -#: /var/azuracast/www/resources/templates/system/form_page.js.phtml:52 +#: /var/azuracast/www/resources/templates/system/form_edit.js.phtml:15 msgid "No results found!" msgstr "" diff --git a/resources/templates/admin/install_shoutcast/installed.phtml b/resources/templates/admin/install_shoutcast/installed.phtml new file mode 100644 index 000000000..46499f9c2 --- /dev/null +++ b/resources/templates/admin/install_shoutcast/installed.phtml @@ -0,0 +1,11 @@ +layout('main', ['title' => __('SHOUTcast is Installed'), 'manual' => true]) ?> + +
+
+

+
+ +
+

+
+
diff --git a/src/Controller/Admin/Install/ShoutcastController.php b/src/Controller/Admin/Install/ShoutcastController.php new file mode 100644 index 000000000..6e932ecfa --- /dev/null +++ b/src/Controller/Admin/Install/ShoutcastController.php @@ -0,0 +1,70 @@ +form_config = $form_config; + } + + public function __invoke(Request $request, Response $response): Response + { + if (SHOUTcast::isInstalled()) { + return $request + ->getView() + ->renderToResponse($response, 'admin/install_shoutcast/installed'); + } + + $form = new \AzuraForms\Form($this->form_config, []); + + if ($request->isPost() && $form->isValid($_POST)) { + try + { + $sc_base_dir = dirname(APP_INCLUDE_ROOT) . '/servers/shoutcast2'; + + $files = $request->getUploadedFiles(); + /** @var UploadedFile $import_file */ + $import_file = $files['binary']; + + if ($import_file->getError() === \UPLOAD_ERR_OK) { + $sc_tgz_path = $sc_base_dir.'/sc_serv.tar.gz'; + + $import_file->moveTo($sc_tgz_path); + + $sc_tgz = new \PharData($sc_tgz_path); + $sc_tgz->decompress(); + + $sc_tar_path = $sc_base_dir.'/sc_serv.tar'; + + $sc_tar = new \PharData($sc_tar_path); + $sc_tar->extractTo($sc_base_dir); + } + + return $response->withRedirect($request->getUri()->getPath()); + } catch(\Exception $e) { + $form + ->getField('binary') + ->addError(get_class($e).': '.$e->getMessage()); + } + } + + return $request->getView()->renderToResponse($response, 'system/form_page', [ + 'form' => $form, + 'render_mode' => 'edit', + 'title' => __('Install SHOUTcast'), + ]); + } +} diff --git a/src/Plugins.php b/src/Plugins.php index 626c37bd7..039781c3e 100644 --- a/src/Plugins.php +++ b/src/Plugins.php @@ -21,6 +21,7 @@ class Plugins $plugins = (new Finder()) ->ignoreUnreadableDirs() ->directories() + ->depth('== 0') ->in($dir); foreach($plugins as $plugin_dir) { diff --git a/src/Provider/AdminProvider.php b/src/Provider/AdminProvider.php index a50ed697c..37a1bc0ad 100644 --- a/src/Provider/AdminProvider.php +++ b/src/Provider/AdminProvider.php @@ -112,5 +112,14 @@ class AdminProvider implements ServiceProviderInterface ]) ); }; + + $di[Admin\Install\ShoutcastController::class] = function($di) { + /** @var \App\Config $config */ + $config = $di[\App\Config::class]; + + return new Admin\Install\ShoutcastController( + $config->get('forms/install_shoutcast') + ); + }; } } diff --git a/src/Radio/Adapters.php b/src/Radio/Adapters.php index 3388749df..17f5217d3 100644 --- a/src/Radio/Adapters.php +++ b/src/Radio/Adapters.php @@ -127,7 +127,7 @@ class Adapters /** * @return array */ - public static function listFrontendAdapters(): array + public static function listFrontendAdapters($check_installed = false): array { static $adapters; @@ -146,8 +146,10 @@ class Adapters 'class' => Frontend\Remote::class, ], ]; + } - $adapters = array_filter($adapters, function($adapter_info) { + if ($check_installed) { + return array_filter($adapters, function($adapter_info) { /** @var \App\Radio\AdapterAbstract $adapter_class */ $adapter_class = $adapter_info['class']; return $adapter_class::isInstalled(); @@ -160,7 +162,7 @@ class Adapters /** * @return array */ - public static function listBackendAdapters(): array + public static function listBackendAdapters($check_installed = false): array { static $adapters; @@ -175,8 +177,10 @@ class Adapters 'class' => Backend\None::class, ], ]; + } - $adapters = array_filter($adapters, function ($adapter_info) { + if ($check_installed) { + return array_filter($adapters, function ($adapter_info) { /** @var \App\Radio\AdapterAbstract $adapter_class */ $adapter_class = $adapter_info['class']; return $adapter_class::isInstalled(); diff --git a/src/Radio/Frontend/SHOUTcast.php b/src/Radio/Frontend/SHOUTcast.php index 5346259c1..d0b3c1bff 100644 --- a/src/Radio/Frontend/SHOUTcast.php +++ b/src/Radio/Frontend/SHOUTcast.php @@ -203,10 +203,13 @@ class SHOUTcast extends FrontendAbstract { $new_path = dirname(APP_INCLUDE_ROOT) . '/servers/shoutcast2/sc_serv'; - if (APP_INSIDE_DOCKER || file_exists($new_path)) { + // Docker versions before 3 included the SC binary across the board. + if (APP_INSIDE_DOCKER && APP_DOCKER_REVISION < 3) { return $new_path; } - return false; + return file_exists($new_path) + ? $new_path + : false; } } diff --git a/util/ansible/roles/azuracast-radio/tasks/x86.yml b/util/ansible/roles/azuracast-radio/tasks/x86.yml index 2021c4cc0..633a03dab 100644 --- a/util/ansible/roles/azuracast-radio/tasks/x86.yml +++ b/util/ansible/roles/azuracast-radio/tasks/x86.yml @@ -63,25 +63,3 @@ shell: "opam init -y && opam update && opam install -y taglib.0.3.3 mad.0.4.5 faad.0.4.0 fdkaac.0.2.1 lame.0.3.3 vorbis.0.7.0 cry.0.6.0 opus.0.1.2 flac.0.1.2 liquidsoap.1.3.4" args: chdir: "{{ app_base }}" - - - name: Download ShoutCast 2 (x86) - get_url: - url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux-latest.tar.gz - dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz" - when: ansible_architecture == 'i386' - - - name: Download ShoutCast 2 (x64) - get_url: - url: http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64-latest.tar.gz - dest: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz" - when: ansible_architecture == 'x86_64' - - - name: Extract ShoutCast 2 Binary - unarchive: - src: "{{ app_base }}/servers/shoutcast2/sc_serv.tar.gz" - dest: "{{ app_base }}/servers/shoutcast2" - remote_src: yes - mode: "u=rwx,g=rx,o=rx" - owner: "azuracast" - group: "www-data" - # creates: "{{ app_base }}/servers/shoutcast2/sc_serv" diff --git a/util/docker/testing/Dockerfile b/util/docker/testing/Dockerfile index 9894a5902..384f7a644 100644 --- a/util/docker/testing/Dockerfile +++ b/util/docker/testing/Dockerfile @@ -4,3 +4,8 @@ ENV PATH="${PATH}:/var/azuracast/.composer/vendor/bin" RUN apt-get update \ && apt-get install -q -y php7.2-xdebug + +RUN mkdir -p /tmp/blackfire \ + && curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ + && rm -Rf /tmp/blackfire diff --git a/util/docker/web/Dockerfile b/util/docker/web/Dockerfile new file mode 100644 index 000000000..bea6d7551 --- /dev/null +++ b/util/docker/web/Dockerfile @@ -0,0 +1,9 @@ +FROM azuracast/azuracast_web:latest + +RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \ + && mkdir -p /tmp/blackfire \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > /etc/php/7.2/fpm/conf.d/blackfire.ini \ + && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz