@@ -2356,18 +2356,37 @@ Spicetify.Playbar = (() => {
2356
2356
if ( ! check_spicetify_update || ! version || version === "Dev" ) return ;
2357
2357
// Fetch latest version from GitHub
2358
2358
try {
2359
+ let changelog ;
2359
2360
const res = await fetch ( "https://api.github.com/repos/spicetify/spicetify-cli/releases/latest" ) ;
2360
2361
const { tag_name, html_url, body } = await res . json ( ) ;
2361
2362
const semver = tag_name . slice ( 1 ) ;
2362
- const changelogRawData = body . match ( / # # W h a t ' s C h a n g e d ( [ \s \S ] * ?) \r \n \r / ) [ 1 ] ;
2363
- const changelog = [ ...changelogRawData . matchAll ( / \r \n \* \s ( .+ ?) \s i n \s h t t p s / g) ]
2364
- . map ( match => {
2365
- const featureData = match [ 1 ] . split ( "@" ) ;
2366
- const feature = featureData [ 0 ] ;
2367
- const committerID = featureData [ 1 ] ;
2368
- return `<li>${ feature } <a href="https://github.com/${ committerID } ">${ committerID } </a></li>` ;
2369
- } )
2370
- . join ( "\n" ) ;
2363
+ const changelogRawDataOld = body . match ( / # # W h a t ' s C h a n g e d ( [ \s \S ] * ?) \r \n \r / ) ?. [ 1 ] ;
2364
+ if ( changelogRawDataOld ) {
2365
+ changelog = [ ...changelogRawDataOld . matchAll ( / \r \n \* \s ( .+ ?) \s i n \s h t t p s / g) ]
2366
+ . map ( match => {
2367
+ const featureData = match [ 1 ] . split ( "@" ) ;
2368
+ const feature = featureData [ 0 ] ;
2369
+ const committerID = featureData [ 1 ] ;
2370
+ return `<li>${ feature } <a href="https://github.com/${ committerID } ">${ committerID } </a></li>` ;
2371
+ } )
2372
+ . join ( "\n" ) ;
2373
+ } else {
2374
+ const sections = body . split ( "\n## " ) ;
2375
+ const filteredSections = sections . filter ( section => ! section . startsWith ( "Compatibility" ) ) ;
2376
+ const filteredText = filteredSections . join ( "\n## " ) ;
2377
+ changelog = [ ...filteredText . matchAll ( / - (?: \* \* ( .+ ?) \* \* : ? ) ? ( .+ ?) \( \[ ( .+ ?) \] \( ( .+ ?) \) \) / g) ]
2378
+ . map ( match => {
2379
+ const feature = match [ 1 ] ;
2380
+ const description = match [ 2 ] ;
2381
+ const prNumber = match [ 3 ] ;
2382
+ const prLink = match [ 4 ] ;
2383
+ let text = "<li>" ;
2384
+ if ( feature ) text += `<strong>${ feature } </strong>: ` ;
2385
+ text += `${ description } (<a href="${ prLink } ">${ prNumber } </a>)</li>` ;
2386
+ return text ;
2387
+ } )
2388
+ . join ( "\n" ) ;
2389
+ }
2371
2390
2372
2391
if ( semver !== version ) {
2373
2392
const content = document . createElement ( "div" ) ;
0 commit comments