diff --git a/lib/MusicBrainz/Server/Data/URL.pm b/lib/MusicBrainz/Server/Data/URL.pm index 505573615d2..6b364cec927 100644 --- a/lib/MusicBrainz/Server/Data/URL.pm +++ b/lib/MusicBrainz/Server/Data/URL.pm @@ -97,7 +97,7 @@ my %URL_SPECIALIZATIONS = ( 'iTunes' => qr{^https?://itunes\.apple\.com/}i, 'Jamendo' => qr{^https?://(?:www\.)?jamendo\.com/}i, 'Japameta' => qr{^https?://(?:www\.)?japanesemetal\.gooside\.com/}i, - 'Jaxsta' => qr{^https?://(?:www\.)?jaxsta\.com/}i, + 'Jaxsta' => qr{^https?://(?:www\.)?jaxsta\.(?:com|io)/}i, 'JazzMusicArchives' => qr{^https?://(?:www\.)?jazzmusicarchives\.com/}i, 'JLyric' => qr{^https?://(?:www\.)?j-lyric\.net/}i, 'Joysound' => qr{^https?://(?:www\.)?joysound\.com/}i, diff --git a/root/static/scripts/common/constants.js b/root/static/scripts/common/constants.js index 09705a501be..ee406d875b7 100644 --- a/root/static/scripts/common/constants.js +++ b/root/static/scripts/common/constants.js @@ -144,7 +144,7 @@ export const FAVICON_CLASSES: { 'iss.ndl.go.jp': 'ndl', 'itunes.apple.com': 'itunes', 'j-lyric.net': 'jlyric', - 'jaxsta.com': 'jaxsta', + 'jaxsta.io': 'jaxsta', 'jazzmusicarchives.com': 'jazzmusicarchives', 'joysound.com': 'joysound', 'junodownload.com': 'junodownload', diff --git a/root/static/scripts/edit/URLCleanup.js b/root/static/scripts/edit/URLCleanup.js index 47f437bf202..05c91912fee 100644 --- a/root/static/scripts/edit/URLCleanup.js +++ b/root/static/scripts/edit/URLCleanup.js @@ -3198,13 +3198,13 @@ const CLEANUPS: CleanupEntries = { }, }, 'jaxsta': { - match: [/^(https?:\/\/)?(www\.)?jaxsta\.com/i], + match: [/^(https?:\/\/)?(www\.)?jaxsta\.(com|io)/i], restrict: [ LINK_TYPES.otherdatabases, {work: [LINK_TYPES.otherdatabases.work, LINK_TYPES.lyrics.work]}, ], select(url, sourceType) { - const m = /^https:\/\/jaxsta\.com\/(\w+)\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$/.exec(url); + const m = /^https:\/\/jaxsta\.io\/(\w+)\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(?:\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$/.exec(url); if (m) { const prefix = m[1]; switch (prefix) { @@ -3218,12 +3218,12 @@ const CLEANUPS: CleanupEntries = { return false; }, clean(url) { - url = url.replace(/^(?:https?:\/\/)?(?:www\.)?jaxsta\.com\/([^#?]+).*$/, 'https://jaxsta.com/$1'); - url = url.replace(/^https:\/\/jaxsta\.com\/(\w+)\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})(\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?.*$/, 'https://jaxsta.com/$1/$2$3'); + url = url.replace(/^(?:https?:\/\/)?(?:www\.)?jaxsta\.(?:com|io)\/([^#?]+).*$/, 'https://jaxsta.io/$1'); + url = url.replace(/^https:\/\/jaxsta\.io\/(\w+)\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})(\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?.*$/, 'https://jaxsta.io/$1/$2$3'); return url; }, validate(url, id) { - const m = /^https:\/\/jaxsta\.com\/(\w+)\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$/.exec(url); + const m = /^https:\/\/jaxsta\.io\/(\w+)\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})?$/.exec(url); if (m) { const type = m[1]; const hasVariant = Boolean(m[2]); diff --git a/root/static/scripts/tests/Control/URLCleanup.js b/root/static/scripts/tests/Control/URLCleanup.js index 43e9cef4acf..653afefacd0 100644 --- a/root/static/scripts/tests/Control/URLCleanup.js +++ b/root/static/scripts/tests/Control/URLCleanup.js @@ -3214,28 +3214,35 @@ limited_link_type_combinations: [ input_url: 'http://www.jaxsta.com/profile/8a9bd5c6-1ce2-4f1d-bfdc-1a2383129c79/catalogue?role_group=Featured%20Artist&view=tile', input_entity_type: 'artist', expected_relationship_type: 'otherdatabases', - expected_clean_url: 'https://jaxsta.com/profile/8a9bd5c6-1ce2-4f1d-bfdc-1a2383129c79', + expected_clean_url: 'https://jaxsta.io/profile/8a9bd5c6-1ce2-4f1d-bfdc-1a2383129c79', + only_valid_entity_types: ['artist', 'label'], + }, + { + input_url: 'https://jaxsta.io/profile/902b15e8-ed89-41d7-a7c0-a35caf2c2801/credits', + input_entity_type: 'artist', + expected_relationship_type: 'otherdatabases', + expected_clean_url: 'https://jaxsta.io/profile/902b15e8-ed89-41d7-a7c0-a35caf2c2801', only_valid_entity_types: ['artist', 'label'], }, { input_url: 'https://jaxsta.com/profile/5a50b1be-7473-4e51-ae4b-bb8d9ac13407/catalogue?view=tile', input_entity_type: 'label', expected_relationship_type: 'otherdatabases', - expected_clean_url: 'https://jaxsta.com/profile/5a50b1be-7473-4e51-ae4b-bb8d9ac13407', + expected_clean_url: 'https://jaxsta.io/profile/5a50b1be-7473-4e51-ae4b-bb8d9ac13407', only_valid_entity_types: ['artist', 'label'], }, { input_url: 'https://jaxsta.com/recording/5b01140a-a82f-5f5c-aa81-93d61de00f94/releases', input_entity_type: 'recording', expected_relationship_type: 'otherdatabases', - expected_clean_url: 'https://jaxsta.com/recording/5b01140a-a82f-5f5c-aa81-93d61de00f94', + expected_clean_url: 'https://jaxsta.io/recording/5b01140a-a82f-5f5c-aa81-93d61de00f94', only_valid_entity_types: ['recording'], }, { input_url: 'https://jaxsta.com/release/66512305-5fb7-5d43-a194-d5ed56c16cab/7c5528fe-96f7-5c0c-9af2-9b756b909436/variants', input_entity_type: 'release', expected_relationship_type: 'otherdatabases', - expected_clean_url: 'https://jaxsta.com/release/66512305-5fb7-5d43-a194-d5ed56c16cab/7c5528fe-96f7-5c0c-9af2-9b756b909436', + expected_clean_url: 'https://jaxsta.io/release/66512305-5fb7-5d43-a194-d5ed56c16cab/7c5528fe-96f7-5c0c-9af2-9b756b909436', only_valid_entity_types: ['release'], }, { @@ -3246,7 +3253,7 @@ limited_link_type_combinations: [ 'otherdatabases', ['lyrics', 'otherdatabases'], ], - expected_clean_url: 'https://jaxsta.com/work/2aa4e869-85d4-5099-92fb-5a8aa1494d32', + expected_clean_url: 'https://jaxsta.io/work/2aa4e869-85d4-5099-92fb-5a8aa1494d32', only_valid_entity_types: ['work'], }, // Jazz Music Archives