Fixed broken urls in manifest.json

This commit is contained in:
Eliot Berriot 2020-01-09 16:12:17 +01:00
parent ef6219e8c4
commit 9ab3afa47f
No known key found for this signature in database
GPG Key ID: 6B501DFD73514E14
3 changed files with 9 additions and 3 deletions

View File

@ -10,6 +10,7 @@ from rest_framework.response import Response
from funkwhale_api.common import middleware
from funkwhale_api.common import preferences
from funkwhale_api.federation import utils as federation_utils
from funkwhale_api.users.oauth import permissions as oauth_permissions
from . import nodeinfo
@ -57,6 +58,7 @@ class SpaManifest(views.APIView):
)
parsed_manifest = json.loads(existing_manifest)
parsed_manifest["short_name"] = settings.APP_NAME
parsed_manifest["start_url"] = federation_utils.full_url("/")
instance_name = preferences.get("instance__name")
if instance_name:
parsed_manifest["short_name"] = instance_name

View File

@ -2,6 +2,8 @@ import json
from django.urls import reverse
from funkwhale_api.federation import utils as federation_utils
def test_nodeinfo_endpoint(db, api_client, mocker):
payload = {"test": "test"}
@ -54,6 +56,7 @@ def test_manifest_endpoint(api_client, mocker, preferences, tmp_path, settings):
"name": "Test pod",
"short_name": "Test pod",
"description": "Test description",
"start_url": federation_utils.full_url("/"),
}
manifest.write_bytes(json.dumps(base_payload).encode())

View File

@ -1,3 +1,4 @@
const baseUrl = process.env.BASE_URL || '/front/'
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpack = require('webpack');
@ -30,7 +31,7 @@ plugins.push(
}),
)
module.exports = {
baseUrl: process.env.BASE_URL || '/front/',
baseUrl: baseUrl,
productionSourceMap: false,
// Add settings for manifest file
pwa: {
@ -48,11 +49,11 @@ module.exports = {
categories: ["music"],
icons: [
{
'src': 'favicon.png',
'src': baseUrl + 'favicon.png',
'sizes': '192x192',
'type': 'image/png'
}, {
'src': 'favicon.png',
'src': baseUrl + 'favicon.png',
'sizes': '512x512',
'type': 'image/png'
},