Skip to content

Commit 3b40fe5

Browse files
committed
feat: fix format
1 parent b5fe89e commit 3b40fe5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simpmusic-utils",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Extract cookies from YouTube Music (String or Netscape format) and Spotify (sp_dc parameter)",
55
"main": "dist/background.js",
66
"scripts": {

src/background.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,25 @@ const getYouTubeMusicCookiesNetscape = async (): Promise<string> => {
6262

6363
// Netscape cookie file format header
6464
let netscapeFormat = '# Netscape HTTP Cookie File\n';
65-
netscapeFormat += '# This is a generated file! Do not edit.\n\n';
65+
netscapeFormat += '# This is a generated file by SimpMusic Utils! Do not edit.\n\n';
6666

6767
// Convert cookies to Netscape format
6868
for (const cookie of allCookies) {
69-
const domain = cookie.domain.startsWith('.') ? cookie.domain.substring(1) : cookie.domain;
69+
// Keep the domain as-is, preserving the leading dot if present
70+
const domain = cookie.domain;
71+
// The flag indicates if the cookie is valid for subdomains
72+
const includeSubdomains = cookie.domain.startsWith('.') ? 'TRUE' : 'FALSE';
7073
const path = cookie.path || '/';
7174
const secure = cookie.secure ? 'TRUE' : 'FALSE';
7275
const expires = cookie.expirationDate ? cookie.expirationDate.toString() : '0';
7376

74-
netscapeFormat += `${domain}\tTRUE\t${path}\t${secure}\t${expires}\t${cookie.name}\t${cookie.value}\n`;
77+
netscapeFormat += `${domain}\t${includeSubdomains}\t${path}\t${secure}\t${expires}\t${cookie.name}\t${cookie.value}\n`;
7578
}
7679

7780
return netscapeFormat;
7881
};
7982

83+
8084
// Function to get Spotify cookies (specifically sp_dc)
8185
const getSpotifyCookies = async (): Promise<{ sp_dc?: string }> => {
8286
const cookies = await chrome.cookies.getAll({

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "SimpMusic Utils",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"description": "Extract cookies from YouTube Music (String or Netscape format) and Spotify (sp_dc parameter)",
66
"permissions": ["cookies", "tabs", "storage", "activeTab"],
77
"host_permissions": [

0 commit comments

Comments
 (0)