Merge remote-tracking branch 'origin/master'

This commit is contained in:
Frisk 2020-11-14 10:26:28 +01:00
commit 9e4d14e9d6
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
3 changed files with 160 additions and 111 deletions

View file

@ -23,17 +23,17 @@
"level": 15
},
"file": {
"formatter": "standard",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "logs/error.log",
"formatter": "standard",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "logs/error.log",
"interval": 7,
"when": "D",
"level": 25
},
"debug": {
"formatter": "standard",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "debug.log",
"formatter": "standard",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "logs/debug.log",
"interval": 7,
"when": "D",
"level": 0
@ -53,16 +53,12 @@
"rcgcdb.wiki": {}
}
},
"appearance": {
"appearance": {
"mode": "embed",
"embed": {
"show_footer": true,
"show_edit_changes": true,
"embed_images": true,
"daily_overview": {
"color": 16312092,
"icon": ""
},
"new": {
"icon": "https://i.imgur.com/6HIbEq8.png",
"color": "THIS COLOR DEPENDS ON EDIT SIZE, PLEASE DON'T CHANGE"
@ -77,11 +73,11 @@
},
"upload/upload": {
"icon": "https://i.imgur.com/egJpa81.png",
"color": null
"color": 12390624
},
"upload/revert": {
"icon": "https://i.imgur.com/egJpa81.png",
"color": null
"color": 12390624
},
"delete/delete": {
"icon": "https://i.imgur.com/BU77GD3.png",
@ -93,27 +89,27 @@
},
"delete/restore": {
"icon": "https://i.imgur.com/9MnROIU.png",
"color": null
"color": 1
},
"delete/revision": {
"icon": "https://i.imgur.com/1gps6EZ.png",
"color": null
"color": 1
},
"delete/event": {
"icon": "https://i.imgur.com/1gps6EZ.png",
"color": null
"color": 1
},
"merge/merge": {
"icon": "https://i.imgur.com/uQMK9XK.png",
"color": null
"color": 25600
},
"move/move": {
"icon": "https://i.imgur.com/eXz9dog.png",
"color": null
"color": 25600
},
"move/move_redir": {
"icon": "https://i.imgur.com/UtC3YX2.png",
"color": null
"color": 25600
},
"block/block": {
"icon": "https://i.imgur.com/g7KgZHf.png",
@ -129,167 +125,219 @@
},
"protect/protect": {
"icon": "https://i.imgur.com/bzPt89Z.png",
"color": null
"color": 16312092
},
"protect/modify": {
"icon": "https://i.imgur.com/bzPt89Z.png",
"color": null
"color": 16312092
},
"protect/move_prot": {
"icon": "https://i.imgur.com/bzPt89Z.png",
"color": null
"color": 16312092
},
"protect/unprotect": {
"icon": "https://i.imgur.com/2wN3Qcq.png",
"color": null
"color": 16312092
},
"import/upload": {
"icon": "",
"color": null
"color": 65280
},
"import/interwiki": {
"icon": "https://i.imgur.com/sFkhghb.png",
"color": null
"color": 65280
},
"rights/rights": {
"icon": "",
"color": null
"color": 16711680
},
"abusefilter/abusefilter": {
"icon": "https://i.imgur.com/Sn2NzRJ.png",
"color": null
"color": 16711680
},
"abusefilter/modify": {
"icon": "https://i.imgur.com/Sn2NzRJ.png",
"color": null
"color": 16711680
},
"abusefilter/create": {
"icon": "https://i.imgur.com/Sn2NzRJ.png",
"color": null
"color": 16711680
},
"interwiki/iw_add": {
"icon": "https://i.imgur.com/sFkhghb.png",
"color": null
"color": 16711680
},
"interwiki/iw_edit": {
"icon": "https://i.imgur.com/sFkhghb.png",
"color": null
"color": 16711680
},
"interwiki/iw_delete": {
"icon": "https://i.imgur.com/sFkhghb.png",
"color": null
"color": 16711680
},
"curseprofile/comment-created": {
"icon": "https://i.imgur.com/Lvy5E32.png",
"color": null
"color": 16089376
},
"curseprofile/comment-edited": {
"icon": "https://i.imgur.com/Lvy5E32.png",
"color": null
"color": 16089376
},
"curseprofile/comment-deleted": {
"icon": "",
"color": null
"color": 16089376
},
"curseprofile/comment-purged":{
"icon":"",
"color":null
"color":16089376
},
"curseprofile/comment-replied": {
"icon": "https://i.imgur.com/hkyYsI1.png",
"color": null
"color": 16089376
},
"curseprofile/profile-edited": {
"icon": "",
"color": null
"color": 16089376
},
"contentmodel/change": {
"icon": "",
"color": null
"color": 25600
},
"cargo/deletetable": {
"icon": "",
"color": null
},
"cargo/createtable": {
"color": 16776960
},
"cargo/createtable": {
"icon": "",
"color": null
},
"cargo/replacetable": {
"color": 16776960
},
"cargo/replacetable": {
"icon": "",
"color": null
},
"cargo/recreatetable": {
"color": 16776960
},
"cargo/recreatetable": {
"icon": "",
"color": null
},
"color": 16776960
},
"sprite/sprite": {
"icon": "",
"color": null
"color": 16776960
},
"sprite/sheet": {
"icon": "",
"color": null
"color": 16776960
},
"sprite/slice": {
"icon": "",
"color": null
"color": 16776960
},
"managetags/create": {
"icon": "",
"color": null
"color": 16776960
},
"managetags/delete": {
"icon": "",
"color": null
"color": 16776960
},
"managetags/activate": {
"icon": "",
"color": null
"color": 16776960
},
"managetags/deactivate": {
"icon": "",
"color": null
"color": 16776960
},
"tag/update": {
"icon": "",
"color": null
"color": 16776960
},
"newusers/autocreate": {
"icon": "",
"color": 65280
},
"newusers/byemail": {
"icon": "",
"color": 65280
},
"newusers/create": {
"icon": "",
"color": 65280
},
"newusers/create2": {
"icon": "",
"color": 65280
},
"newusers/newusers": {
"icon": "",
"color": 65280
},
"managewiki/delete": {
"icon": "",
"color": 8421504
},
"managewiki/lock": {
"icon": "",
"color": 8421504
},
"managewiki/namespaces": {
"icon": "",
"color": 8421504
},
"managewiki/namespaces-delete": {
"icon": "",
"color": 8421504
},
"managewiki/rights": {
"icon": "",
"color": 8421504
},
"managewiki/settings": {
"icon": "",
"color": 8421504
},
"managewiki/undelete": {
"icon": "",
"color": 8421504
},
"managewiki/unlock": {
"icon": "",
"color": 8421504
},
"suppressed": {
"icon": "https://i.imgur.com/1gps6EZ.png",
"color": 8092539
"color": 1
},
"discussion/forum/post": {
"icon": "",
"color":null
"color": 54998
},
"discussion/forum/reply": {
"icon": "",
"color":null
},
"color": 54998
},
"discussion/forum/poll": {
"icon": "",
"color":null
"color": 54998
},
"discussion/forum/quiz": {
"icon": "",
"color":null
"color": 54998
},
"discussion/wall/post": {
"icon": "",
"color":null
"color": 3752525
},
"discussion/wall/reply": {
"icon": "",
"color":null
"color": 3752525
},
"discussion/comment/post": {
"icon": "",
"color":null
"color": 10802
},
"discussion/comment/reply": {
"icon": "",
"color":null
"color": 10802
}
}
}

View file

@ -214,7 +214,7 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH))
content = "🔒 "+_("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url,
article=change["title"], article_url=link,
settings=change["logparams"]["description"]+_(" [cascading]") if "cascade" in change["logparams"] else "",
settings=change["logparams"]["description"]+(_(" [cascading]") if "cascade" in change["logparams"] else ""),
comment=parsed_comment)
elif action == "protect/modify":
link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH))
@ -222,7 +222,7 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
"[{author}]({author_url}) modified protection settings of [{article}]({article_url}) to: {settings}{comment}").format(
author=author, author_url=author_url,
article=change["title"], article_url=link,
settings=change["logparams"]["description"] + _(" [cascading]") if "cascade" in change["logparams"] else "",
settings=change["logparams"]["description"] + (_(" [cascading]") if "cascade" in change["logparams"] else ""),
comment=parsed_comment)
elif action == "protect/unprotect":
link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH))

View file

@ -112,9 +112,11 @@ def profile_field_name(name, embed, lang):
class ContentParser(HTMLParser):
current_tag = ""
last_ins = None
last_del = None
empty = False
small_prev_ins = ""
small_prev_del = ""
added = False
def __init__(self, lang):
super().__init__()
@ -125,58 +127,57 @@ class ContentParser(HTMLParser):
def handle_starttag(self, tagname, attribs):
if tagname == "ins" or tagname == "del":
self.current_tag = tagname
if tagname == "td" and 'diff-addedline' in attribs[0]:
self.current_tag = tagname + "a"
if tagname == "td" and 'diff-deletedline' in attribs[0]:
self.current_tag = tagname + "d"
if tagname == "td" and 'diff-marker' in attribs[0]:
self.added = True
if tagname == "td" and "diff-addedline" in attribs[0] and self.ins_length <= 1000:
self.current_tag = "tda"
self.last_ins = ""
if tagname == "td" and "diff-deletedline" in attribs[0] and self.del_length <= 1000:
self.current_tag = "tdd"
self.last_del = ""
if tagname == "td" and "diff-empty" in attribs[0]:
self.empty = True
def handle_data(self, data):
data = escape_formatting(data)
if self.current_tag == "ins" and self.ins_length <= 1000:
self.ins_length += len("**" + data + '**')
self.ins_length += len("**" + data + "**")
if self.ins_length <= 1000:
self.small_prev_ins = self.small_prev_ins + "**" + data + '**'
else:
self.small_prev_ins = self.small_prev_ins + self.more
self.last_ins = self.last_ins + "**" + data + "**"
if self.current_tag == "del" and self.del_length <= 1000:
self.del_length += len("~~" + data + '~~')
self.del_length += len("~~" + data + "~~")
if self.del_length <= 1000:
self.small_prev_del = self.small_prev_del + "~~" + data + '~~'
else:
self.small_prev_del = self.small_prev_del + self.more
if (self.current_tag == "afterins" or self.current_tag == "tda") and self.ins_length <= 1000:
self.last_del = self.last_del + "~~" + data + "~~"
if self.current_tag == "tda" and self.ins_length <= 1000:
self.ins_length += len(data)
if self.ins_length <= 1000:
self.small_prev_ins = self.small_prev_ins + data
else:
self.small_prev_ins = self.small_prev_ins + self.more
if (self.current_tag == "afterdel" or self.current_tag == "tdd") and self.del_length <= 1000:
self.last_ins = self.last_ins + data
if self.current_tag == "tdd" and self.del_length <= 1000:
self.del_length += len(data)
if self.del_length <= 1000:
self.small_prev_del = self.small_prev_del + data
else:
self.small_prev_del = self.small_prev_del + self.more
if self.added:
if data == '+' and self.ins_length <= 1000:
self.ins_length += 1
if self.ins_length <= 1000:
self.small_prev_ins = self.small_prev_ins + '\n'
else:
self.small_prev_ins = self.small_prev_ins + self.more
if data == '' and self.del_length <= 1000:
self.del_length += 1
if self.del_length <= 1000:
self.small_prev_del = self.small_prev_del + '\n'
else:
self.small_prev_del = self.small_prev_del + self.more
self.added = False
self.last_del = self.last_del + data
def handle_endtag(self, tagname):
self.current_tag = ""
if tagname == "ins":
self.current_tag = "afterins"
self.current_tag = "tda"
elif tagname == "del":
self.current_tag = "afterdel"
else:
self.current_tag = ""
self.current_tag = "tdd"
elif tagname == "tr":
if self.last_ins is not None:
self.ins_length += 1
if self.empty and not self.last_ins.isspace() and "**" not in self.last_ins:
self.ins_length += 4
self.last_ins = "**" + self.last_ins + "**"
self.small_prev_ins = self.small_prev_ins + "\n" + self.last_ins
if self.ins_length > 1000:
self.small_prev_ins = self.small_prev_ins + self.more
self.last_ins = None
if self.last_del is not None:
self.del_length += 1
if self.empty and not self.last_del.isspace() and "~~" not in self.last_del:
self.del_length += 4
self.last_del = "~~" + self.last_del + "~~"
self.small_prev_del = self.small_prev_del + "\n" + self.last_del
if self.del_length > 1000:
self.small_prev_del = self.small_prev_del + self.more
self.last_del = None
self.empty = False