2019-07-09 16:44:56 +00:00
|
|
|
import logging
|
2019-09-04 18:52:16 +00:00
|
|
|
import re
|
2019-07-09 16:44:56 +00:00
|
|
|
|
2019-08-25 15:02:41 +00:00
|
|
|
from flask import Flask, request, url_for, redirect, abort, make_response
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
import ycast.vtuner as vtuner
|
|
|
|
import ycast.radiobrowser as radiobrowser
|
2019-08-14 14:01:30 +00:00
|
|
|
import ycast.my_stations as my_stations
|
2019-08-22 18:30:29 +00:00
|
|
|
import ycast.generic as generic
|
2019-08-25 15:02:41 +00:00
|
|
|
import ycast.station_icons as station_icons
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
PATH_ROOT = 'ycast'
|
2019-08-22 18:30:29 +00:00
|
|
|
PATH_PLAY = 'play'
|
2019-08-22 21:16:40 +00:00
|
|
|
PATH_STATION = 'station'
|
2019-08-21 21:37:16 +00:00
|
|
|
PATH_SEARCH = 'search'
|
2019-08-25 15:02:41 +00:00
|
|
|
PATH_ICON = 'icon'
|
2019-08-14 14:01:30 +00:00
|
|
|
PATH_MY_STATIONS = 'my_stations'
|
2019-07-09 16:44:56 +00:00
|
|
|
PATH_RADIOBROWSER = 'radiobrowser'
|
|
|
|
PATH_RADIOBROWSER_COUNTRY = 'country'
|
2019-08-19 13:00:48 +00:00
|
|
|
PATH_RADIOBROWSER_LANGUAGE = 'language'
|
2019-07-09 16:44:56 +00:00
|
|
|
PATH_RADIOBROWSER_GENRE = 'genre'
|
|
|
|
PATH_RADIOBROWSER_POPULAR = 'popular'
|
|
|
|
|
2019-08-27 17:37:57 +00:00
|
|
|
station_tracking = False
|
2019-08-14 14:01:30 +00:00
|
|
|
my_stations_enabled = False
|
2019-07-09 16:44:56 +00:00
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def run(config, address='0.0.0.0', port=8010):
|
|
|
|
try:
|
2019-08-14 14:01:30 +00:00
|
|
|
check_my_stations_feature(config)
|
2019-07-09 16:44:56 +00:00
|
|
|
app.run(host=address, port=port)
|
|
|
|
except PermissionError:
|
|
|
|
logging.error("No permission to create socket. Are you trying to use ports below 1024 without elevated rights?")
|
|
|
|
|
|
|
|
|
2019-08-14 14:01:30 +00:00
|
|
|
def check_my_stations_feature(config):
|
|
|
|
global my_stations_enabled
|
|
|
|
my_stations_enabled = my_stations.set_config(config)
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2019-08-22 18:30:29 +00:00
|
|
|
def get_directories_page(subdir, directories, request):
|
2019-07-17 13:44:35 +00:00
|
|
|
page = vtuner.Page()
|
|
|
|
if len(directories) == 0:
|
2019-08-25 13:30:41 +00:00
|
|
|
page.add(vtuner.Display("No entries found"))
|
|
|
|
page.set_count(1)
|
2019-07-17 13:44:35 +00:00
|
|
|
return page
|
2019-08-22 18:30:29 +00:00
|
|
|
for directory in get_paged_elements(directories, request.args):
|
2020-10-10 14:36:44 +00:00
|
|
|
vtuner_directory = vtuner.Directory(directory.displayname,
|
|
|
|
url_for(subdir, _external=True, directory=directory.name),
|
2019-08-18 11:50:38 +00:00
|
|
|
directory.item_count)
|
2019-08-17 21:52:55 +00:00
|
|
|
page.add(vtuner_directory)
|
2019-08-17 18:23:40 +00:00
|
|
|
page.set_count(len(directories))
|
2019-07-17 13:44:35 +00:00
|
|
|
return page
|
|
|
|
|
|
|
|
|
2019-08-27 17:37:57 +00:00
|
|
|
def get_stations_page(stations, request):
|
2019-07-17 13:44:35 +00:00
|
|
|
page = vtuner.Page()
|
|
|
|
if len(stations) == 0:
|
2019-08-25 13:30:41 +00:00
|
|
|
page.add(vtuner.Display("No stations found"))
|
|
|
|
page.set_count(1)
|
2019-07-17 13:44:35 +00:00
|
|
|
return page
|
2019-08-22 18:30:29 +00:00
|
|
|
for station in get_paged_elements(stations, request.args):
|
|
|
|
vtuner_station = station.to_vtuner()
|
2019-08-27 17:37:57 +00:00
|
|
|
if station_tracking:
|
2019-08-22 18:30:29 +00:00
|
|
|
vtuner_station.set_trackurl(request.host_url + PATH_ROOT + '/' + PATH_PLAY + '?id=' + vtuner_station.uid)
|
2019-08-25 15:02:41 +00:00
|
|
|
vtuner_station.icon = request.host_url + PATH_ROOT + '/' + PATH_ICON + '?id=' + vtuner_station.uid
|
2019-08-22 18:30:29 +00:00
|
|
|
page.add(vtuner_station)
|
2019-08-17 18:23:40 +00:00
|
|
|
page.set_count(len(stations))
|
2019-07-17 13:44:35 +00:00
|
|
|
return page
|
|
|
|
|
|
|
|
|
2019-08-16 13:05:40 +00:00
|
|
|
def get_paged_elements(items, requestargs):
|
2019-08-12 13:22:46 +00:00
|
|
|
if requestargs.get('startitems'):
|
2019-08-16 13:05:40 +00:00
|
|
|
offset = int(requestargs.get('startitems')) - 1
|
2020-06-06 09:30:26 +00:00
|
|
|
elif requestargs.get('startItems'):
|
|
|
|
offset = int(requestargs.get('startItems')) - 1
|
2019-08-12 13:22:46 +00:00
|
|
|
elif requestargs.get('start'):
|
2019-08-16 13:05:40 +00:00
|
|
|
offset = int(requestargs.get('start')) - 1
|
2019-08-12 13:22:46 +00:00
|
|
|
else:
|
2019-08-16 13:05:40 +00:00
|
|
|
offset = 0
|
2019-08-17 21:52:55 +00:00
|
|
|
if offset > len(items):
|
|
|
|
logging.warning("Paging offset larger than item count")
|
|
|
|
return []
|
2019-08-12 13:22:46 +00:00
|
|
|
if requestargs.get('enditems'):
|
2019-08-16 13:05:40 +00:00
|
|
|
limit = int(requestargs.get('enditems'))
|
2020-06-06 09:30:26 +00:00
|
|
|
elif requestargs.get('endItems'):
|
|
|
|
limit = int(requestargs.get('endItems'))
|
2019-08-12 13:22:46 +00:00
|
|
|
elif requestargs.get('start') and requestargs.get('howmany'):
|
2019-08-16 13:05:40 +00:00
|
|
|
limit = int(requestargs.get('start')) - 1 + int(requestargs.get('howmany'))
|
2019-08-12 13:22:46 +00:00
|
|
|
else:
|
2019-08-16 13:05:40 +00:00
|
|
|
limit = len(items)
|
2019-08-17 21:52:55 +00:00
|
|
|
if limit < offset:
|
|
|
|
logging.warning("Paging limit smaller than offset")
|
|
|
|
return []
|
2019-08-16 13:05:40 +00:00
|
|
|
if limit > len(items):
|
|
|
|
limit = len(items)
|
|
|
|
return items[offset:limit]
|
2019-08-12 13:22:46 +00:00
|
|
|
|
|
|
|
|
2019-08-26 19:07:23 +00:00
|
|
|
def get_station_by_id(stationid, additional_info=False):
|
2019-08-22 18:30:29 +00:00
|
|
|
station_id_prefix = generic.get_stationid_prefix(stationid)
|
|
|
|
if station_id_prefix == my_stations.ID_PREFIX:
|
|
|
|
return my_stations.get_station_by_id(generic.get_stationid_without_prefix(stationid))
|
|
|
|
elif station_id_prefix == radiobrowser.ID_PREFIX:
|
2019-08-26 18:39:36 +00:00
|
|
|
station = radiobrowser.get_station_by_id(generic.get_stationid_without_prefix(stationid))
|
2019-08-26 19:07:23 +00:00
|
|
|
if additional_info:
|
|
|
|
station.get_playable_url()
|
2019-08-26 18:39:36 +00:00
|
|
|
return station
|
2019-08-22 18:30:29 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
2019-09-04 18:52:16 +00:00
|
|
|
def vtuner_redirect(url):
|
|
|
|
if request and request.host and not re.search("^[A-Za-z0-9]+\.vtuner\.com$", request.host):
|
|
|
|
logging.warning("You are not accessing a YCast redirect with a whitelisted host url (*.vtuner.com). "
|
|
|
|
"Some AVRs have problems with this. The requested host was: %s", request.host)
|
|
|
|
return redirect(url, code=302)
|
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/setupapp/<path:path>',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-21 23:31:13 +00:00
|
|
|
def upstream(path):
|
2019-07-09 16:44:56 +00:00
|
|
|
if request.args.get('token') == '0':
|
|
|
|
return vtuner.get_init_token()
|
2019-08-21 21:37:16 +00:00
|
|
|
if request.args.get('search'):
|
|
|
|
return station_search()
|
2019-08-22 21:16:40 +00:00
|
|
|
if 'statxml.asp' in path and request.args.get('id'):
|
|
|
|
return get_station_info()
|
2020-08-09 19:06:30 +00:00
|
|
|
if 'navXML.asp' in path:
|
|
|
|
return radiobrowser_landing()
|
|
|
|
if 'FavXML.asp' in path:
|
|
|
|
return my_stations_landing()
|
2019-08-21 23:31:13 +00:00
|
|
|
if 'loginXML.asp' in path:
|
2019-08-26 22:29:53 +00:00
|
|
|
return landing()
|
2019-08-21 23:31:13 +00:00
|
|
|
logging.error("Unhandled upstream query (/setupapp/%s)", path)
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/',
|
|
|
|
defaults={'path': ''},
|
|
|
|
methods=['GET', 'POST'])
|
|
|
|
@app.route('/' + PATH_ROOT + '/',
|
|
|
|
defaults={'path': ''},
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-26 22:29:53 +00:00
|
|
|
def landing(path=''):
|
2019-07-09 16:44:56 +00:00
|
|
|
page = vtuner.Page()
|
2019-08-21 21:37:16 +00:00
|
|
|
page.add(vtuner.Directory('Radiobrowser', url_for('radiobrowser_landing', _external=True), 4))
|
2019-08-14 14:01:30 +00:00
|
|
|
if my_stations_enabled:
|
2019-08-17 21:52:55 +00:00
|
|
|
page.add(vtuner.Directory('My Stations', url_for('my_stations_landing', _external=True),
|
2019-08-18 11:50:38 +00:00
|
|
|
len(my_stations.get_category_directories())))
|
2019-08-14 14:01:30 +00:00
|
|
|
else:
|
|
|
|
page.add(vtuner.Display("'My Stations' feature not configured."))
|
2019-08-25 13:30:41 +00:00
|
|
|
page.set_count(1)
|
2019-07-09 16:44:56 +00:00
|
|
|
return page.to_string()
|
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_MY_STATIONS + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-14 14:01:30 +00:00
|
|
|
def my_stations_landing():
|
2019-08-18 11:50:38 +00:00
|
|
|
directories = my_stations.get_category_directories()
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_directories_page('my_stations_category', directories, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_MY_STATIONS + '/<directory>',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-14 14:01:30 +00:00
|
|
|
def my_stations_category(directory):
|
|
|
|
stations = my_stations.get_stations_by_category(directory)
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-09 16:44:56 +00:00
|
|
|
def radiobrowser_landing():
|
|
|
|
page = vtuner.Page()
|
2019-08-17 21:52:55 +00:00
|
|
|
page.add(vtuner.Directory('Genres', url_for('radiobrowser_genres', _external=True),
|
2019-08-18 11:50:38 +00:00
|
|
|
len(radiobrowser.get_genre_directories())))
|
2019-08-17 21:52:55 +00:00
|
|
|
page.add(vtuner.Directory('Countries', url_for('radiobrowser_countries', _external=True),
|
2019-08-18 11:50:38 +00:00
|
|
|
len(radiobrowser.get_country_directories())))
|
2019-08-19 13:00:48 +00:00
|
|
|
page.add(vtuner.Directory('Languages', url_for('radiobrowser_languages', _external=True),
|
|
|
|
len(radiobrowser.get_language_directories())))
|
2019-08-17 21:52:55 +00:00
|
|
|
page.add(vtuner.Directory('Most Popular', url_for('radiobrowser_popular', _external=True),
|
|
|
|
len(radiobrowser.get_stations_by_votes())))
|
2019-08-22 18:42:55 +00:00
|
|
|
page.set_count(4)
|
2019-07-09 16:44:56 +00:00
|
|
|
return page.to_string()
|
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_COUNTRY + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-09 16:44:56 +00:00
|
|
|
def radiobrowser_countries():
|
2019-08-18 11:50:38 +00:00
|
|
|
directories = radiobrowser.get_country_directories()
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_directories_page('radiobrowser_country_stations', directories, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_COUNTRY + '/<directory>',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-17 13:44:35 +00:00
|
|
|
def radiobrowser_country_stations(directory):
|
|
|
|
stations = radiobrowser.get_stations_by_country(directory)
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_LANGUAGE + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-19 13:00:48 +00:00
|
|
|
def radiobrowser_languages():
|
|
|
|
directories = radiobrowser.get_language_directories()
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_directories_page('radiobrowser_language_stations', directories, request).to_string()
|
2019-08-19 13:00:48 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_LANGUAGE + '/<directory>',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-19 13:00:48 +00:00
|
|
|
def radiobrowser_language_stations(directory):
|
|
|
|
stations = radiobrowser.get_stations_by_language(directory)
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
2019-08-19 13:00:48 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_GENRE + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-09 16:44:56 +00:00
|
|
|
def radiobrowser_genres():
|
2019-08-18 11:50:38 +00:00
|
|
|
directories = radiobrowser.get_genre_directories()
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_directories_page('radiobrowser_genre_stations', directories, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_GENRE + '/<directory>',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-17 13:44:35 +00:00
|
|
|
def radiobrowser_genre_stations(directory):
|
|
|
|
stations = radiobrowser.get_stations_by_genre(directory)
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_RADIOBROWSER + '/' + PATH_RADIOBROWSER_POPULAR + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-07-09 16:44:56 +00:00
|
|
|
def radiobrowser_popular():
|
|
|
|
stations = radiobrowser.get_stations_by_votes()
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_SEARCH + '/',
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-21 21:37:16 +00:00
|
|
|
def station_search():
|
2019-08-12 14:31:15 +00:00
|
|
|
query = request.args.get('search')
|
2019-07-09 16:44:56 +00:00
|
|
|
if not query or len(query) < 3:
|
2019-07-17 13:44:35 +00:00
|
|
|
page = vtuner.Page()
|
2019-08-25 13:30:41 +00:00
|
|
|
page.add(vtuner.Display("Search query too short"))
|
2019-08-21 21:37:16 +00:00
|
|
|
page.set_count(1)
|
2019-07-17 13:44:35 +00:00
|
|
|
return page.to_string()
|
2019-07-09 16:44:56 +00:00
|
|
|
else:
|
2019-08-21 21:37:16 +00:00
|
|
|
# TODO: we also need to include 'my station' elements
|
2019-07-09 16:44:56 +00:00
|
|
|
stations = radiobrowser.search(query)
|
2019-08-22 18:30:29 +00:00
|
|
|
return get_stations_page(stations, request).to_string()
|
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_PLAY,
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-22 18:30:29 +00:00
|
|
|
def get_stream_url():
|
|
|
|
stationid = request.args.get('id')
|
|
|
|
if not stationid:
|
|
|
|
logging.error("Stream URL without station ID requested")
|
|
|
|
abort(400)
|
2019-08-26 19:07:23 +00:00
|
|
|
station = get_station_by_id(stationid, additional_info=True)
|
2019-08-22 18:30:29 +00:00
|
|
|
if not station:
|
|
|
|
logging.error("Could not get station with id '%s'", stationid)
|
|
|
|
abort(404)
|
|
|
|
logging.debug("Station with ID '%s' requested", station.id)
|
2019-09-04 18:52:16 +00:00
|
|
|
return vtuner_redirect(station.url)
|
2019-08-22 21:16:40 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_STATION,
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-27 17:37:57 +00:00
|
|
|
def get_station_info():
|
2019-08-22 21:16:40 +00:00
|
|
|
stationid = request.args.get('id')
|
|
|
|
if not stationid:
|
|
|
|
logging.error("Station info without station ID requested")
|
|
|
|
abort(400)
|
2019-08-27 17:37:57 +00:00
|
|
|
station = get_station_by_id(stationid, additional_info=(not station_tracking))
|
2019-08-22 21:16:40 +00:00
|
|
|
if not station:
|
|
|
|
logging.error("Could not get station with id '%s'", stationid)
|
2019-08-25 13:30:41 +00:00
|
|
|
page = vtuner.Page()
|
|
|
|
page.add(vtuner.Display("Station not found"))
|
|
|
|
page.set_count(1)
|
|
|
|
return page.to_string()
|
2019-08-25 14:29:53 +00:00
|
|
|
vtuner_station = station.to_vtuner()
|
2019-08-27 17:37:57 +00:00
|
|
|
if station_tracking:
|
2019-08-25 14:29:53 +00:00
|
|
|
vtuner_station.set_trackurl(request.host_url + PATH_ROOT + '/' + PATH_PLAY + '?id=' + vtuner_station.uid)
|
2019-08-25 15:02:41 +00:00
|
|
|
vtuner_station.icon = request.host_url + PATH_ROOT + '/' + PATH_ICON + '?id=' + vtuner_station.uid
|
2019-08-22 21:16:40 +00:00
|
|
|
page = vtuner.Page()
|
2019-08-25 14:29:53 +00:00
|
|
|
page.add(vtuner_station)
|
2019-08-22 21:16:40 +00:00
|
|
|
page.set_count(1)
|
|
|
|
return page.to_string()
|
2019-08-25 15:02:41 +00:00
|
|
|
|
|
|
|
|
2020-06-29 19:52:18 +00:00
|
|
|
@app.route('/' + PATH_ROOT + '/' + PATH_ICON,
|
|
|
|
methods=['GET', 'POST'])
|
2019-08-25 15:02:41 +00:00
|
|
|
def get_station_icon():
|
|
|
|
stationid = request.args.get('id')
|
|
|
|
if not stationid:
|
|
|
|
logging.error("Station icon without station ID requested")
|
|
|
|
abort(400)
|
|
|
|
station = get_station_by_id(stationid)
|
|
|
|
if not station:
|
|
|
|
logging.error("Could not get station with id '%s'", stationid)
|
|
|
|
abort(404)
|
|
|
|
if not hasattr(station, 'icon') or not station.icon:
|
|
|
|
logging.warning("No icon information found for station with id '%s'", stationid)
|
|
|
|
abort(404)
|
2019-08-25 17:57:24 +00:00
|
|
|
station_icon = station_icons.get_icon(station)
|
2019-08-25 15:02:41 +00:00
|
|
|
if not station_icon:
|
2019-08-25 17:57:24 +00:00
|
|
|
logging.error("Could not get station icon for station with id '%s'", stationid)
|
2019-08-25 15:02:41 +00:00
|
|
|
abort(404)
|
|
|
|
response = make_response(station_icon)
|
|
|
|
response.headers.set('Content-Type', 'image/jpeg')
|
|
|
|
return response
|