diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 29f6105e..8cb8f725 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1366,8 +1366,20 @@ "description": "Header for the table of contents block listing style section names in the left panel of the classic editor" }, "linking": { - "message": "Linking", - "description": "Header for the section to link the style with other services." + "message": "UserStyles.world integration", + "description": "Header for the section to link the style with userStyles.world" + }, + "linkStyle": { + "message": "Link Style", + "description": "Link the current style with userstyles.world" + }, + "uploadStyle": { + "message": "Upload Style", + "description": "Upload the current style to userstyles.world" + }, + "revokeLink": { + "message": "Revoke Link", + "description": "Revoke current link of style with userstyles.world" }, "shortcuts": { "message": "Shortcuts", diff --git a/background/style-manager.js b/background/style-manager.js index 062a1ef1..28ddb649 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -56,10 +56,8 @@ const styleMan = (() => { let ready = init(); chrome.runtime.onConnect.addListener(handleLivePreview); - chrome.runtime.onConnect.addListener(handleLinkingUSW); - //#endregion //#region Exports @@ -381,7 +379,8 @@ const styleMan = (() => { if (!style._usw.token) { return; } - uploadStyle(style._usw.token, style); + uploadStyle(style); + break; } }); } diff --git a/background/usw-api.js b/background/usw-api.js index bc9f4887..96e37aa7 100644 --- a/background/usw-api.js +++ b/background/usw-api.js @@ -14,11 +14,11 @@ async function retrieveStyleInformation(token) { } /* exported uploadStyle */ -async function uploadStyle(token, style) { +async function uploadStyle(style) { return (await (await fetch(`${URLS.usw}api/style/${style._usw.id}`, { method: 'POST', headers: new Headers({ - 'Authorization': `Bearer ${token}`, + 'Authorization': `Bearer ${style._usw.token}`, 'Content-Type': 'application/json', }), body: JSON.stringify({ diff --git a/edit.html b/edit.html index 43279f2e..c4aad8ca 100644 --- a/edit.html +++ b/edit.html @@ -395,12 +395,12 @@

- +
- - + +
diff --git a/edit/edit.js b/edit/edit.js index 26efff25..df531ae9 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -45,7 +45,7 @@ baseInit.ready.then(async () => { $('#lint-help').onclick = () => require(['/edit/linter-dialogs'], () => linterMan.showLintHelp()); $('#link-style').onclick = () => linkToUSW(); - $('#revoke-style').onclick = () => revokeLinking(); + $('#revoke-link').onclick = () => revokeLinking(); $('#upload-style').onclick = () => uploadStyle(); require([ '/edit/autocomplete',