[Pkg-mozext-commits] [personasplus] 15/42: Bug 848186: Get designer URL from AMO API and remove remaining getpersonas references.
David Prévot
taffit at moszumanska.debian.org
Wed Feb 3 16:15:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository personasplus.
commit a21b64a36c8db84c7b6db0cba60a7869bf2bf518
Author: Kris Maglione <maglione.k at gmail.com>
Date: Tue Mar 26 14:48:09 2013 -0700
Bug 848186: Get designer URL from AMO API and remove remaining getpersonas references.
---
extension/content/customPersonaEditor.js | 2 +-
extension/content/personas.js | 23 ++++++++---------------
extension/defaults/preferences/prefs.js | 18 ++++--------------
extension/install.rdf | 2 +-
extension/locale/en-US/personas.properties | 5 ++---
extension/modules/service.js | 30 +++++++++++++-----------------
6 files changed, 29 insertions(+), 51 deletions(-)
diff --git a/extension/content/customPersonaEditor.js b/extension/content/customPersonaEditor.js
index d765914..004e2fb 100644
--- a/extension/content/customPersonaEditor.js
+++ b/extension/content/customPersonaEditor.js
@@ -97,7 +97,7 @@ let CustomPersonaEditor = {
},
get _blankImage() {
- return "http://" + this._prefs.get("host") + "/static/img/blank.gif";
+ return "data:image/gif;base64,R0lGODlhAQABAJH/AP///wAAAMDAwAAAACH5BAEAAAIALAAAAAABAAEAAAICVAEAOw=="
},
customPersona: null,
diff --git a/extension/content/personas.js b/extension/content/personas.js
index d64716a..396772f 100644
--- a/extension/content/personas.js
+++ b/extension/content/personas.js
@@ -143,11 +143,11 @@ let PersonaController = {
get _thunderbirdRegExp() {
delete this._thunderbirdRegExp;
- return this._thunderbirdRegExp = new RegExp("^" + this._siteURL);
+ return this._thunderbirdRegExp = new RegExp("^" + this._siteURL.replace(/\./g, "\\."));
},
get _siteURL() {
- return "https://" + this._prefs.get("host") + "/";
+ return "https://" + this._prefs.get("addons-host") + "/";
},
get _previewTimeout() {
@@ -447,13 +447,11 @@ let PersonaController = {
else {
// Use the URI module to resolve the possibly relative URI to an absolute one.
let headerURI = this.URI.get(persona.headerURL || persona.header,
- null,
- this.URI.get(PersonaService.dataURL));
+ null, null);
this._header.style.backgroundImage = "url(" + this._escapeURLForCSS(headerURI.spec) + ")";
// Use the URI module to resolve the possibly relative URI to an absolute one.
let footerURI = this.URI.get(persona.footerURL || persona.footer,
- null,
- this.URI.get(PersonaService.dataURL));
+ null, null);
this._footer.style.backgroundImage = "url(" + this._escapeURLForCSS(footerURI.spec) + ")";
}
@@ -850,10 +848,6 @@ let PersonaController = {
'chrome,titlebar,toolbar,centerscreen');
}),
- onViewDirectory: PersonaService.wrap(function() {
- this.openURLInTab(this._siteURL + "gallery/All/Popular");
- }),
-
onEditCustomPersona: PersonaService.wrap(function() {
this.openURLInTab("chrome://personas/content/customPersonaEditor.xul");
}),
@@ -1027,16 +1021,15 @@ let PersonaController = {
// with null username. In this case we only check the username is not null
// because it is used to generate the url to go to the personas designer page
// (bug 526788).
- if (PersonaService.currentPersona.custom || !PersonaService.currentPersona.username) {
+ let persona = PersonaService.currentPersona;
+ if (!persona.authorURL) {
personaStatusDesigner.setAttribute("collapsed", true);
} else {
personaStatusDesigner.removeAttribute("collapsed");
- let designerLabel = PersonaService.currentPersona.author ?
- PersonaService.currentPersona.author : PersonaService.currentPersona.username;
+ let designerLabel = persona.author || persona.username;
personaStatusDesigner.setAttribute("label", this._strings.get("viewDesigner", [designerLabel]));
- let designerURL = this._siteURL + "gallery/Designer/" + PersonaService.currentPersona.username;
personaStatusDesigner.setAttribute("oncommand", "PersonaController.openURLInTab(this.getAttribute('href'))");
- personaStatusDesigner.setAttribute("href", designerURL);
+ personaStatusDesigner.setAttribute("href", persona.authorURL);
}
// Update the checkmark on the Default menu item.
diff --git a/extension/defaults/preferences/prefs.js b/extension/defaults/preferences/prefs.js
index 8985868..1a526bc 100644
--- a/extension/defaults/preferences/prefs.js
+++ b/extension/defaults/preferences/prefs.js
@@ -43,28 +43,18 @@ pref("extensions.personas.category", "");
pref("extensions.personas.lastversion", "firstrun");
-// The host where the gallery files are located.
-// Note: this should be the canonical hostname, not one that redirects us
-// to another, since we set the If-Modified-Since header so we can find out
-// when a persona record has changed, and that header doesn't get preserved
-// across redirects because of bug 401564.
-pref("extensions.personas.host", "www.getpersonas.com");
-
-// The host where the data files are located.
-pref("extensions.personas.datahost", "getpersonas-cdn.mozilla.net");
-
pref("extensions.personas.addons-host", "addons.mozilla.org");
pref("extensions.personas.services-host", "services.addons.mozilla.org");
+pref("extensions.personas.addon-details.url", "https://%SERVICES_HOST%/en-US/api/1.5/addon/%ADDON_SLUG%/?format=json");
+
+pref("extensions.personas.browse.url", "https://%ADDONS_HOST%/themes/?sort=%SORT%");
+
pref("extensions.personas.featured-feed.url", "https://%ADDONS_HOST%/collections/mozilla/featured-personas/format:json");
pref("extensions.personas.favorites-feed.url", "https://%ADDONS_HOST%/collections/mine/favorites/format:json");
pref("extensions.personas.favorites-browse.url", "https://%ADDONS_HOST%/collections/mine/favorites/");
-pref("extensions.personas.browse.url", "https://%ADDONS_HOST%/themes/?sort=%SORT%");
-
-pref("extensions.personas.addon-details.url", "https://%SERVICES_HOST%/en-US/api/1.5/addon/%ADDON_SLUG%/?format=json");
-
pref("extensions.personas.initial.slug", "groovy-blue");
// The authorizedHosts preference is a comma and/or space-separated list
diff --git a/extension/install.rdf b/extension/install.rdf
index 87f79a0..7900eb7 100644
--- a/extension/install.rdf
+++ b/extension/install.rdf
@@ -50,7 +50,7 @@
<em:translator>wtspout</em:translator> <!-- ko-KR -->
<em:translator>x10firefox</em:translator> <!-- ro-RO -->
- <em:homepageURL>http://www.getpersonas.com/</em:homepageURL>
+ <em:homepageURL>https://addons.mozilla.org/themes/</em:homepageURL>
<em:iconURL>chrome://personas/content/personas_32x32.png</em:iconURL>
<em:optionsURL>chrome://personas/content/preferences.xul</em:optionsURL>
diff --git a/extension/locale/en-US/personas.properties b/extension/locale/en-US/personas.properties
index c665b12..50c7bcf 100644
--- a/extension/locale/en-US/personas.properties
+++ b/extension/locale/en-US/personas.properties
@@ -20,9 +20,8 @@ customPersona = Custom Persona
viewDesigner = More from %S...
# LOCALIZATION NOTE (viewMore): the label of a command that will load the gallery
-# page on getpersonas.com for this specific category.
-# %1$S = number of additional personas in this category available on the site (e.g. 1,542)
-# %2$2 = the name of the category (e.g. Music)
+# page on addons.mozilla.org for this specific category.
+# %1$S = the name of the category (e.g. Music)
viewMore = More from %1$S...
# LOCALIZATION NOTE (notification.personaWasSelected): the text
diff --git a/extension/modules/service.js b/extension/modules/service.js
index 3daf959..9503885 100644
--- a/extension/modules/service.js
+++ b/extension/modules/service.js
@@ -619,13 +619,6 @@ let PersonaService = {
set category(newVal) { this._prefs.set("category", newVal) },
/**
- * The URL at which the static data is located.
- */
- get dataURL() {
- return "http://" + this._prefs.get("datahost") + "/static/";
- },
-
- /**
* Returns a formatted URL from preferences.
*/
getURL: function(pref, replacements) {
@@ -635,7 +628,7 @@ let PersonaService = {
if (replacements && m1 in replacements)
return encodeURIComponent(replacements[m1]);
- let pref = m1.toLowerCase().replace("_", "-");
+ let pref = m1.toLowerCase().replace(/_/g, "-");
return encodeURIComponent(t._prefs.get(pref));
});
},
@@ -732,7 +725,10 @@ let PersonaService = {
getPersonaJSON: function(data) {
if (data.theme) {
if (data.learnmore && !data.theme.detailURL)
- data.theme.detailURL = this.updateURLSource(data.learnmore);
+ data.theme.detailURL = this.updateURLSource(data.learnmore);
+ let authorURL = data.authors && data.authors[0] && data.authors[0].link;
+ if (authorURL)
+ data.theme.authorURL = this.updateURLSource(authorURL);
return data.theme;
}
return data;
@@ -1132,8 +1128,8 @@ let PersonaService = {
// The header can be a base64 string or a malformed URL, in which case
// the error can be safely ignored.
try {
- let headerURI = URI.get(header, null, URI.get(this.dataURL)).
- QueryInterface(Ci.nsIURL);
+ let headerURI = URI.get(header, null, null)
+ .QueryInterface(Ci.nsIURL);
let headerCallback = function(aEvent) {
let request = aEvent.target;
@@ -1156,8 +1152,8 @@ let PersonaService = {
// The footer can be a base64 string or a malformed URL, in which case
// the error can be safely ignored.
try {
- let footerURI = URI.get(footer, null, URI.get(this.dataURL)).
- QueryInterface(Ci.nsIURL);
+ let footerURI = URI.get(footer, null, null)
+ .QueryInterface(Ci.nsIURL);
let footerCallback = function(aEvent) {
let request = aEvent.target;
// Save only if the folder still exists (Could have been deleted already)
@@ -1193,12 +1189,12 @@ let PersonaService = {
let footerFile = personaDir.clone();
let headerFileExtension =
- URI.get(aPersona.headerURL || aPersona.header, null, URI.get(this.dataURL)).
- QueryInterface(Ci.nsIURL).fileExtension;
+ URI.get(aPersona.headerURL || aPersona.header, null, null)
+ .QueryInterface(Ci.nsIURL).fileExtension;
let footerFileExtension =
- URI.get(aPersona.footerURL || aPersona.footer, null, URI.get(this.dataURL)).
- QueryInterface(Ci.nsIURL).fileExtension;
+ URI.get(aPersona.footerURL || aPersona.footer, null, null)
+ .QueryInterface(Ci.nsIURL).fileExtension;
headerFile.append("header" + "." + headerFileExtension);
footerFile.append("footer" + "." + footerFileExtension);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/personasplus.git
More information about the Pkg-mozext-commits
mailing list