mirror of
				https://github.com/9001/copyparty.git
				synced 2025-10-31 04:32:20 -06:00 
			
		
		
		
	rss: option to not embed pw in feed
This commit is contained in:
		
							parent
							
								
									a499648291
								
							
						
					
					
						commit
						73ec2d296f
					
				|  | @ -1040,6 +1040,8 @@ url parameters: | ||||||
| 
 | 
 | ||||||
| * `pw=hunter2` for password auth | * `pw=hunter2` for password auth | ||||||
|   * if you enabled `--usernames` then do `pw=username:password` instead |   * if you enabled `--usernames` then do `pw=username:password` instead | ||||||
|  | * `nopw` disables embedding the password (if provided) into item-URLs in the feed | ||||||
|  | * `nopw=a` disables mentioning the password anywhere at all in the feed; may break some readers | ||||||
| * `recursive` to also include subfolders | * `recursive` to also include subfolders | ||||||
| * `title=foo` changes the feed title (default: folder name) | * `title=foo` changes the feed title (default: folder name) | ||||||
| * `fext=mp3,opus` only include mp3 and opus files (default: all) | * `fext=mp3,opus` only include mp3 and opus files (default: all) | ||||||
|  |  | ||||||
|  | @ -1425,10 +1425,10 @@ class HttpCli(object): | ||||||
| 
 | 
 | ||||||
|         hits = idx.run_query(self.uname, [self.vn], uq, uv, False, False, nmax)[0] |         hits = idx.run_query(self.uname, [self.vn], uq, uv, False, False, nmax)[0] | ||||||
| 
 | 
 | ||||||
|         pw = self.ouparam.get("pw") |         if "pw" in self.ouparam and "nopw" not in self.ouparam: | ||||||
|         if pw: |             zs = self.ouparam["pw"] | ||||||
|             q_pw = "?pw=%s" % (html_escape(pw, True, True),) |             q_pw = "?pw=%s" % (quotep(zs),) | ||||||
|             a_pw = "&pw=%s" % (html_escape(pw, True, True),) |             a_pw = "&pw=%s" % (quotep(zs),) | ||||||
|             for i in hits: |             for i in hits: | ||||||
|                 i["rp"] += a_pw if "?" in i["rp"] else q_pw |                 i["rp"] += a_pw if "?" in i["rp"] else q_pw | ||||||
|         else: |         else: | ||||||
|  | @ -1442,6 +1442,8 @@ class HttpCli(object): | ||||||
|             self.host, |             self.host, | ||||||
|         ) |         ) | ||||||
|         feed = baseurl + self.req[1:] |         feed = baseurl + self.req[1:] | ||||||
|  |         if "pw" in self.ouparam and self.ouparam.get("nopw") == "a": | ||||||
|  |             feed = re.sub(r"&pw=[^&]*", "", feed) | ||||||
|         if self.is_vproxied: |         if self.is_vproxied: | ||||||
|             baseurl += self.args.RS |             baseurl += self.args.RS | ||||||
|         efeed = html_escape(feed, True, True) |         efeed = html_escape(feed, True, True) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue