mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Alternate quote tweet formats
							parent
							
								
									7383588305
								
							
						
					
					
						commit
						1b5143f4da
					
				
							
								
								
									
										16
									
								
								utils.py
								
								
								
								
							
							
						
						
									
										16
									
								
								utils.py
								
								
								
								
							|  | @ -4132,7 +4132,23 @@ def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> []: | ||||||
| def is_quote_toot(post_json_object: str) -> bool: | def is_quote_toot(post_json_object: str) -> bool: | ||||||
|     """Returns true if the given post is a quote toot |     """Returns true if the given post is a quote toot | ||||||
|     """ |     """ | ||||||
|  |     # Pleroma implementation | ||||||
|     if post_json_object['object'].get('quoteUri') or \ |     if post_json_object['object'].get('quoteUri') or \ | ||||||
|        post_json_object['object'].get('quoteUrl'): |        post_json_object['object'].get('quoteUrl'): | ||||||
|         return True |         return True | ||||||
|  |     # More correct ActivityPub implementation | ||||||
|  |     if post_json_object['object'].get('tag'): | ||||||
|  |         if isinstance(post_json_object['object']['tag'], list): | ||||||
|  |             for item in post_json_object['object']['tag']: | ||||||
|  |                 if not isinstance(item, dict): | ||||||
|  |                     continue | ||||||
|  |                 if not item.get('type'): | ||||||
|  |                     continue | ||||||
|  |                 if not item.get('mediaType'): | ||||||
|  |                     continue | ||||||
|  |                 if item['type'] != 'Link': | ||||||
|  |                     continue | ||||||
|  |                 if 'json' not in item['mediaType']: | ||||||
|  |                     continue | ||||||
|  |                 return True | ||||||
|     return False |     return False | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue