Anonymous avatar Anonymous committed f70d4be

fixed updating for api/find_tags

Comments (0)

Files changed (4)

chrome/content/danbooruup/contents.rdf

 	</RDF:Seq>
 
 	<RDF:Description RDF:about="urn:mozilla:package:danbooruup"
-        	chrome:displayName="Danbooru Uploader 0.2.2"
+        	chrome:displayName="Danbooru Uploader 0.2.3"
 	        chrome:author="Buffered"
 		chrome:authorURL="http://unbuffered.info/danbooruup/"
 		chrome:settingsURL="chrome://danbooruup/content/danbooruUpOptions.xul"

chrome/content/danbooruup/danbooruUp.js

 			.getService(Components.interfaces.nsICacheService);
 var prefService		= Components.classes["@mozilla.org/preferences-service;1"]
 			.getService(Components.interfaces.nsIPrefBranch);
+var ioService		= Components.classes["@mozilla.org/network/io-service;1"]
+			.getService(Components.interfaces.nsIIOService);
 
 var danbooruUpMsg	= StrBundleSvc.createBundle('chrome://danbooruup/locale/danbooruUp.properties');
 var commondlgMsg	= StrBundleSvc.createBundle('chrome://mozapps/locale/extensions/update.properties');
 	},
 	update: function(aFull)
 	{
-		tagService.updateTagListFromURI("http://danbooru.donmai.us/tag/list_raw"
-						+ ((this.mMaxID>0 && !aFull)?"/after/"+(this.mMaxID+1):"") );
+		var locationURL	= ioService.newURI(prefService.getCharPref("extensions.danbooruUp.updateuri"), '', null)
+				.QueryInterface(Components.interfaces.nsIURL);
+		if(this.mMaxID>0 && !aFull)
+		{
+			locationURL.query = "after="+(this.mMaxID+1);
+		}
+		tagService.updateTagListFromURI(locationURL.spec);
 		this.mMaxID = this.getMaxID();
 		prefService.setIntPref("extensions.danbooruUp.autocomplete.update.lastupdate", Date.now());
 
 	var browser	= getBrowser();
 	var thistab	= browser.getBrowserForTab(browser.selectedTab);
 
-	var ioService	= Components.classes["@mozilla.org/network/io-service;1"]
-			.getService(Components.interfaces.nsIIOService);
 	var locationURI	= ioService.newURI(danbooruImgNode.ownerDocument.location,
 					danbooruImgNode.ownerDocument.characterSet, null);
 	var imgURI = ioService.newURI(imgURIStr, danbooruImgNode.ownerDocument.characterSet, locationURI);
 
 function danbooruStartUpload(aRealSource, aSource, aTags, aTitle, aDest, aNode, aWind, aUpdate)
 {
-	var ioService	= Components.classes["@mozilla.org/network/io-service;1"]
-			.getService(Components.interfaces.nsIIOService);
 	var uploader;
 	var imgChannel	= ioService.newChannelFromURI(aRealSource);
 	var os		= Components.classes["@mozilla.org/observer-service;1"]
 	var fieldTitle		= "title";
 	var fieldTags		= "tags";
 
-	var ioService	= Components.classes["@mozilla.org/network/io-service;1"]
-			.getService(Components.interfaces.nsIIOService);
 	var postDS	= Components.classes["@mozilla.org/io/multiplex-input-stream;1"]
 			.createInstance(Components.interfaces.nsIMultiplexInputStream)
 			.QueryInterface(Components.interfaces.nsIInputStream);
 	mUpdateTags:false,
 
 	start:function(aDatastream, aImgURI, aUpURIStr, aTab, aUpdateTags) {
-		var ioService	= Components.classes["@mozilla.org/network/io-service;1"]
-				.getService(Components.interfaces.nsIIOService);
 		this.mUpdateTags = aUpdateTags;
 		// upload URI and cookie info
 		this.mChannel = ioService.newChannel(aUpURIStr, "", null)

defaults/preferences/danbooruup.js

 pref("extensions.danbooruUp.postadduri", "http://danbooru.donmai.us/api/add_post");
 pref("extensions.danbooruUp.postadduri.selected", 0);
 pref("extensions.danbooruUp.fileurlsource", false);
-pref("extensions.danbooruUp.updateuri", "http://danbooru.donmai.us/tag/list_raw");
+pref("extensions.danbooruUp.updateuri", "http://danbooru.donmai.us/api/find_tags");
 pref("extensions.danbooruUp.autocomplete.enabled", true);
 pref("extensions.danbooruUp.autocomplete.update.onstartup", true);
 pref("extensions.danbooruUp.autocomplete.update.faststartup", true);
 	<Description about="urn:mozilla:install-manifest">
 		<em:id>{7209145A-6A2A-42C1-99EB-4DE7293990E1}</em:id>
 		<em:name>Danbooru Uploader</em:name>
-		<em:version>0.2.2</em:version>
+		<em:version>0.2.3</em:version>
 		<em:description>Uploads images to danbooru from the context menu.</em:description>
 		<em:creator>Buffered</em:creator>
 		<em:homepageURL>http://unbuffered.info/danbooruup/</em:homepageURL>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.