Compare commits
	
		
			4 commits
		
	
	
		
			bcac3d716e
			...
			e4ca2eecce
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e4ca2eecce | |||
| 507b5f48b0 | |||
| cb424f69e1 | |||
| 722e62bb20 | 
					 4 changed files with 87 additions and 7 deletions
				
			
		|  | @ -53,7 +53,7 @@ def ls_packages(path): | |||
|     packages = set() | ||||
|     items = path.listdir() | ||||
|     for item in items: | ||||
|         if item.is_dir and '.' in item.basename: | ||||
|         if item.is_dir and '.' in item.basename and not item.with_child('disable').exists: | ||||
|             packages.add(item.basename) | ||||
|         elif item.is_file and item.extension == 'apk': | ||||
|             package = item.basename.split('-')[0] | ||||
|  |  | |||
|  | @ -18,9 +18,11 @@ log = vlogging.getLogger(__name__, 'getcrx') | |||
| FILENAME_BADCHARS = '\\/:*?<>|"' | ||||
| 
 | ||||
| WEBSTORE_URL = 'https://chrome.google.com/webstore/detail/{extension_id}' | ||||
| CRX_URL = 'https://clients2.google.com/service/update2/crx?response=redirect&prodversion=83.0.4103.116&acceptformat=crx2,crx3&x=id%3D{extension_id}%26uc' | ||||
| CRX_URL = 'https://clients2.google.com/service/update2/crx?response=redirect&prodversion=121.0.6167.161&acceptformat=crx2,crx3&x=id%3D{extension_id}%26uc' | ||||
| USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36' | ||||
| 
 | ||||
| session = requests.Session() | ||||
| session.headers={'User-Agent': USER_AGENT} | ||||
| 
 | ||||
| def sanitize_filename(name): | ||||
|     for c in FILENAME_BADCHARS: | ||||
|  | @ -29,7 +31,7 @@ def sanitize_filename(name): | |||
| 
 | ||||
| def get_webstore_name_version(extension_id): | ||||
|     url = WEBSTORE_URL.format(extension_id=extension_id) | ||||
|     response = session.get(url) | ||||
|     response = session.get(url, timeout=60) | ||||
|     response.raise_for_status() | ||||
| 
 | ||||
|     try: | ||||
|  |  | |||
							
								
								
									
										70
									
								
								makespam.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								makespam.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,70 @@ | |||
| import time | ||||
| import textwrap | ||||
| import re | ||||
| import html | ||||
| import pyperclip | ||||
| 
 | ||||
| TEMPLATE = ''' | ||||
|     <article> | ||||
| {selectheaders} | ||||
|         <details> | ||||
|         <summary>Headers</summary> | ||||
|         <pre> | ||||
| {headers} | ||||
|         </pre> | ||||
|         </details> | ||||
| 
 | ||||
|         <hr/> | ||||
| 
 | ||||
| {body} | ||||
|     </article> | ||||
| ''' | ||||
| 
 | ||||
| 
 | ||||
| print('Copy the body...') | ||||
| pyperclip.copy('') | ||||
| while pyperclip.paste() == '': | ||||
|     time.sleep(0.5) | ||||
| body = html.escape(pyperclip.paste()) | ||||
| body = body.replace('\r', '') | ||||
| body = [line.strip() for line in body.splitlines()] | ||||
| body = [line for line in body if line] | ||||
| body = ['<p>' + line + '</p>' for line in body] | ||||
| body = '\n'.join(body) | ||||
| body = textwrap.indent(body, '        ') | ||||
| 
 | ||||
| print('Copy the headers...') | ||||
| pyperclip.copy('') | ||||
| while pyperclip.paste() == '': | ||||
|     time.sleep(0.5) | ||||
| headers = html.escape(pyperclip.paste()) | ||||
| headers = headers.replace('\r', '') | ||||
| headers = [line.rstrip() for line in headers.splitlines()] | ||||
| headers = [line for line in headers if line] | ||||
| headers = '\n'.join(headers) | ||||
| 
 | ||||
| keyed = {} | ||||
| for line in headers.splitlines(): | ||||
|     key = re.search(r'^([A-Za-z\-]+): ', line, flags=re.MULTILINE) | ||||
|     if key is None: | ||||
|         continue | ||||
|     key = key.group(1) | ||||
|     line = line.replace(key + ':', '<p><b>' + key + '</b>:') | ||||
|     keyed[key] = line | ||||
| 
 | ||||
| selectheaders = [ | ||||
|     keyed.get('From'), | ||||
|     keyed.get('Reply-To'), | ||||
|     keyed.get('Return-Path'), | ||||
|     keyed.get('To'), | ||||
|     keyed.get('Bcc'), | ||||
|     keyed.get('Subject'), | ||||
|     keyed.get('Date'), | ||||
| ] | ||||
| selectheaders = [s for s in selectheaders if s] | ||||
| selectheaders = '\n'.join(selectheaders) | ||||
| selectheaders = textwrap.indent(selectheaders, '        ') | ||||
| 
 | ||||
| spam = TEMPLATE.format(body=body, headers=headers, selectheaders=selectheaders) | ||||
| print(spam) | ||||
| pyperclip.copy(spam) | ||||
|  | @ -109,7 +109,8 @@ article .photograph:last-of-type | |||
| { | ||||
|     margin-bottom: 0; | ||||
| } | ||||
| .photograph img | ||||
| .photograph img, | ||||
| .photograph video | ||||
| { | ||||
|     max-height: 92vh; | ||||
|     border-radius: 8px; | ||||
|  | @ -286,12 +287,19 @@ pre, | |||
|     <p>Click each photo to view its full resolution. Click the number to download it.</p> | ||||
| 
 | ||||
|     {% for file in files %} | ||||
|     {% if file.extension == 'jpg' %} | ||||
|     <article class="photograph"> | ||||
|         <a target="_blank" href="{{urlroot}}{{file.relative_to('.', simple=True)}}"><img loading="lazy" src="{{urlroot}}thumbs/small_{{file.relative_to('.', simple=True)}}"/></a> | ||||
|         {% if with_download_links %} | ||||
|         <a class="download_link" download="{{file.basename}}" href="{{urlroot}}{{file.relative_to('.', simple=True)}}">#{{loop.index}}/{{files|length}}</a> | ||||
|         {% endif %} | ||||
|     </article> | ||||
|     {% elif file.extension in ['mp4', 'mov'] %} | ||||
|     <article class="photograph"> | ||||
|         <p>{{file.replace_extension('').basename}}</p> | ||||
|         <video controls preload="none" src="{{urlroot}}{{file.relative_to('.', simple=True)}}" poster="{{urlroot}}thumbs/small_{{file.replace_extension('jpg').relative_to('.', simple=True)}}"></video> | ||||
|     </article> | ||||
|     {% endif %} | ||||
|     {% endfor %} | ||||
| </body> | ||||
| 
 | ||||
|  | @ -332,7 +340,7 @@ function get_center_img() | |||
|     { | ||||
|         const element = document.elementFromPoint(center_x, center_y); | ||||
|         console.log(element); | ||||
|         if (element.tagName === "IMG") | ||||
|         if (element.tagName === "IMG" || element.tagName === "VIDEO") | ||||
|         { | ||||
|             return element; | ||||
|         } | ||||
|  | @ -345,7 +353,7 @@ function get_center_img() | |||
| } | ||||
| function next_img(img) | ||||
| { | ||||
|     const images = Array.from(document.images); | ||||
|     const images = Array.from(document.querySelectorAll("img,video")); | ||||
|     const this_index = images.indexOf(img); | ||||
|     if (this_index === images.length-1) | ||||
|     { | ||||
|  | @ -355,7 +363,7 @@ function next_img(img) | |||
| } | ||||
| function previous_img(img) | ||||
| { | ||||
|     const images = Array.from(document.images); | ||||
|     const images = Array.from(document.querySelectorAll("img,video")); | ||||
|     const this_index = images.indexOf(img); | ||||
|     if (this_index === 0) | ||||
|     { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue