Building to sub /assets/ folder
This commit is contained in:
@ -79,21 +79,47 @@ def iris_factory(config, core):
|
||||
path = os.path.join( os.path.dirname(__file__), 'static')
|
||||
|
||||
return [
|
||||
(r"/images/(.*)", tornado.web.StaticFileHandler, {
|
||||
'path': config['local-images']['image_dir']
|
||||
}),
|
||||
(r'/http/([^/]*)', handlers.HttpHandler, {
|
||||
'core': core,
|
||||
'config': config
|
||||
}),
|
||||
(r'/ws/?', handlers.WebsocketHandler, {
|
||||
'core': core,
|
||||
'config': config
|
||||
}),
|
||||
(r'/([^.]*)', ReactRouterHandler, {
|
||||
'path': path+'/index.html'
|
||||
}),
|
||||
(r'/(.*)', tornado.web.StaticFileHandler, {
|
||||
'path': path
|
||||
}),
|
||||
(
|
||||
r"/images/(.*)",
|
||||
tornado.web.StaticFileHandler,
|
||||
{
|
||||
'path': config['local-images']['image_dir']
|
||||
}
|
||||
),
|
||||
(
|
||||
r'/http/([^/]*)',
|
||||
handlers.HttpHandler,
|
||||
{
|
||||
'core': core,
|
||||
'config': config
|
||||
}
|
||||
),
|
||||
(
|
||||
r'/ws/?',
|
||||
handlers.WebsocketHandler,
|
||||
{
|
||||
'core': core,
|
||||
'config': config
|
||||
}
|
||||
),
|
||||
(
|
||||
r'/assets/(.*)',
|
||||
tornado.web.StaticFileHandler,
|
||||
{
|
||||
'path': path+'/assets'
|
||||
}
|
||||
),
|
||||
(
|
||||
r'/app/(.*)',
|
||||
tornado.web.StaticFileHandler,
|
||||
{
|
||||
'path': path+'/app'
|
||||
}
|
||||
),
|
||||
(
|
||||
r'/(.*)',
|
||||
ReactRouterHandler, {
|
||||
'path': path+'/index.html'
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
# Remove /iris/ from all requests (except /ws) to accommodate the
|
||||
# ./mopidy/{extension} webserver format
|
||||
RewriteCond %{REQUEST_URI} !^/ws/
|
||||
RewriteRule ^iris/(.*)$ /$1 [NC,L]
|
||||
# Rewrite our application folders
|
||||
RewriteRule ^iris/service-worker.js app/service-worker.js [L]
|
||||
RewriteRule ^iris/assets/(.*) assets/$1 [L]
|
||||
RewriteRule ^iris/app/(.*) app/$1 [L]
|
||||
|
||||
# Rewrite all non-file URLs to our React index.html
|
||||
# This is essential for React Router to handle page refreshers
|
||||
RewriteCond %{REQUEST_URI} ^(.*)$
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule .* index.html [L]
|
||||
</IfModule>
|
||||
# Setup non-react folders and assets. These need to be accessible
|
||||
# outside of the ReactJS app.
|
||||
RewriteCond %{REQUEST_URI} app [OR]
|
||||
RewriteCond %{REQUEST_URI} assets
|
||||
RewriteRule (.*) $1 [L]
|
||||
|
||||
# Rewrite everything else to our ReactJS app
|
||||
# This allows nice URLS and React-Router will do the rest
|
||||
RewriteRule ^ index.html [L]
|
||||
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"app.css","sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"app.min.css","sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
mopidy_iris/static/app/app.css.map
Normal file
1
mopidy_iris/static/app/app.css.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"app/app.css","sourceRoot":""}
|
||||
@ -1527,16 +1527,15 @@ var uriType = exports.uriType = function uriType(uri) {
|
||||
var buildLink = exports.buildLink = function buildLink(uri) {
|
||||
|
||||
// Start the link with the URI type
|
||||
var link = "/" + uriType(uri) + "/";
|
||||
var type = uriType(uri);
|
||||
var link = "/" + type + "/";
|
||||
|
||||
// Remove any forward slashes. These interfere with encoding as they're
|
||||
// technically a valid URL component.
|
||||
//uri = uri.replace('/','%2F');
|
||||
// Encode the whole URI as though it's a component. This makes it URL friendly for
|
||||
// all Mopidy backends (some use URIs like local:track:http://rss.com/stuff.mp3) which
|
||||
// is never going to work nicely.
|
||||
uri = encodeURIComponent(uri);
|
||||
link += uri;
|
||||
|
||||
console.log(link);
|
||||
|
||||
return link;
|
||||
};
|
||||
|
||||
@ -7511,7 +7510,7 @@ var sendRequest = function sendRequest(dispatch, getState, params) {
|
||||
|
||||
// Snatch a more meaningful error
|
||||
var description = null;
|
||||
if (xhr.responseJSON.message) {
|
||||
if (xhr && xhr.responseJSON && xhr.responseJSON.message) {
|
||||
description = xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
@ -76175,8 +76174,9 @@ var Track = function (_React$Component) {
|
||||
* Rebuild a track URI with some ugly-ass handling of encoding.
|
||||
*
|
||||
* Basically the ID part of a Mopidy URI needs to be encoded, but the rest of the URI can't be.
|
||||
* This means we need to break down the URI (decoded) and then reconstruct with an encoded ID
|
||||
* because the URI is passed to us from a URL.
|
||||
* This means we need to break down the URI (decoded) and then reconstruct with an encoded ID.
|
||||
* This is all required because he URI is passed to us *from* a URL which has been encoded for
|
||||
* obvious reasons.
|
||||
*
|
||||
* @param uri String
|
||||
* @return String
|
||||
@ -76201,6 +76201,8 @@ var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
var uri = decodeURIComponent(ownProps.match.params.uri);
|
||||
uri = rebuildUri(uri);
|
||||
|
||||
console.log(uri);
|
||||
|
||||
return {
|
||||
uri: uri,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
1
mopidy_iris/static/app/app.js.map
Normal file
1
mopidy_iris/static/app/app.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
mopidy_iris/static/app/app.min.css.map
Normal file
1
mopidy_iris/static/app/app.min.css.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"app/app.min.css","sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
1
mopidy_iris/static/app/app.min.js.map
Normal file
1
mopidy_iris/static/app/app.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": "/iris/#/",
|
||||
"start_url": "/iris/",
|
||||
"background_color": "#08d58f",
|
||||
"theme_color": "#181818",
|
||||
"display": "standalone",
|
||||
3
mopidy_iris/static/app/service-worker.js
Executable file
3
mopidy_iris/static/app/service-worker.js
Executable file
@ -0,0 +1,3 @@
|
||||
self.addEventListener('fetch', (event) => {
|
||||
// Nothing doing!
|
||||
});
|
||||
@ -7,7 +7,7 @@
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
||||
<link rel="manifest" href="/iris/manifest.json" />
|
||||
<link rel="manifest" href="/iris/app/manifest.json" />
|
||||
|
||||
<!-- App setup -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
if ('serviceWorker' in navigator){
|
||||
navigator.serviceWorker.register('/iris/service-worker.js')
|
||||
navigator.serviceWorker.register('/iris/app/service-worker.js')
|
||||
.then(function(registration){
|
||||
console.log('Service worker registered');
|
||||
}).catch(function(error){
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1551075397";
|
||||
var build = "1551219592";
|
||||
var version = "3.33.0";
|
||||
|
||||
// Construct the script tag
|
||||
@ -120,13 +120,13 @@
|
||||
|
||||
// Test mode, use un-minified code
|
||||
if (test_mode){
|
||||
css.href = '/iris/app.css?v='+build;
|
||||
js.src = '/iris/app.js?v='+build;
|
||||
css.href = '/iris/app/app.css?v='+build;
|
||||
js.src = '/iris/app/app.js?v='+build;
|
||||
|
||||
// Production-grade, minified app
|
||||
} else {
|
||||
css.href = '/iris/app.min.css?v='+build;
|
||||
js.src = '/iris/app.min.js?v='+build;
|
||||
css.href = '/iris/app/app.min.css?v='+build;
|
||||
js.src = '/iris/app/app.min.js?v='+build;
|
||||
}
|
||||
|
||||
// And finally inject our CSS/JS tags
|
||||
|
||||
Reference in New Issue
Block a user