def del_profile(self): aws.delete_file( name=f"users/{self.username}/profile-{self.profile_nonce}.png") self.has_profile = False db.add(self) db.commit()
def admin_csam_nuke(pid, v): post = get_post(pid) post.is_banned = True post.ban_reason = "CSAM [1]" g.db.add(post) ma = ModAction(user_id=1, target_submission_id=post.id, board_id=post.board_id, kind="ban_post", note="CSAM detected") user = post.author user.is_banned = v.id g.db.add(user) for alt in user.alts: alt.is_banned = v.id g.db.add(alt) if post.domain == "i.ruqqus.com": x = requests.get(url) # load image into PIL # take phash # add phash to db name = urlparse(post.url).path.lstrip('/') delete_file(name) # this also dumps cloudflare
def del_banner(self): aws.delete_file( name=f"users/{self.username}/banner-{self.banner_nonce}.png") self.has_banner = False db.add(self) db.commit()
def del_banner(self): aws.delete_file( name=f"board/{self.name.lower()}/banner-{self.banner_nonce}.png") self.has_banner = False db.add(self) db.commit()
def del_profile(self): aws.delete_file( name=f"board/{self.name.lower()}/profile-{self.profile_nonce}.png") self.has_profile = False db.add(self) db.commit()
def del_function(post): del_function aws.delete_file(urlparse(post.thumb_url).path.lstrip('/')) #post.has_thumb=False if post.url and post.domain=="i.ruqqus.com": aws.delete_file(urlparse(post.url).path.lstrip('/'))
def del_banner(self): aws.delete_file( name=f"users/{self.username}/banner-{self.banner_nonce}.png") self.has_banner = False try: g.db.add(self) except: pass
def del_profile(self): aws.delete_file( name=f"users/{self.username}/profile-{self.profile_nonce}.png") self.has_profile = False try: g.db.add(self) except: pass
def del_banner(self): if self.banner_set_utc>1616443200: aws.delete_file(name=f"uid/{self.base36id}/banner-{self.banner_nonce}.png") else: aws.delete_file(name=f"users/{self.username}/banner-{self.banner_nonce}.png") self.has_banner = False try: g.db.add(self) except: pass
def del_profile(self): if self.profile_set_utc>1616443200: aws.delete_file(name=f"uid/{self.base36id}/profile-{self.profile_nonce}.png") else: aws.delete_file(name=f"users/{self.username}/profile-{self.profile_nonce}.png") self.has_profile = False try: g.db.add(self) except: pass
def admin_image_purge(v): url = request.form.get("url") parsed_url = urlparse(url) name = parsed_url.path.lstrip('/') try: print(name) except: pass aws.delete_file(name) return "", 204
def admin_purge_guild_images(boardname, v): #Iterates through all posts in guild with thumbnail, and nukes thumbnails and i.ruqqus uploads board=get_guild(boardname) if not board.is_banned: return jsonify({"error":"This guild isn't banned"}), 409 if board.has_profile: board.del_profile() if board.has_banner: board.del_banner() posts = g.db.query(Submission).options(lazyload('*')).filter_by(board_id=board.id, has_thumb=True) i=0 for post in posts: i+=1 aws.delete_file(urlparse(post.thumb_url).path.lstrip('/')) post.has_thumb=False if post.url and post.domain=="i.ruqqus.com": aws.delete_file(urlparse(post.url).path.lstrip('/')) g.db.add(post) if not i%100: g.db.commit() g.db.commit() return redirect(board.permalink)
def admin_csam_nuke(pid, v): post = get_post(pid) post.is_banned = True post.ban_reason = "CSAM [1]" g.db.add(post) user = post.author user.is_banned = v.id g.db.add(user) for alt in user.alts: alt.is_banned = v.id g.db.add(alt) if post.domain == "i.ruqqus.com": x = requests.get(url) #load image into PIL #take phash #add phash to db name = urlparse(post.url).path.lstrip('/') delete_file(name) #this also dumps cloudflare