Add forum_url to API, change to forum.luanti.org
This commit is contained in:
@@ -57,7 +57,7 @@ def _get_or_create_user(forums_username: str, cache: Optional[dict] = None) -> O
|
||||
def check_forum_account(forums_username, force_replace_pic=False):
|
||||
print("### Checking " + forums_username, file=sys.stderr)
|
||||
try:
|
||||
profile = get_profile("https://forum.minetest.net", forums_username)
|
||||
profile = get_profile("https://forum.luanti.org", forums_username)
|
||||
except OSError as e:
|
||||
print(e, file=sys.stderr)
|
||||
return
|
||||
@@ -88,13 +88,13 @@ def check_forum_account(forums_username, force_replace_pic=False):
|
||||
db.session.commit()
|
||||
|
||||
if pic:
|
||||
pic = urljoin("https://forum.minetest.net/", pic)
|
||||
pic = urljoin("https://forum.luanti.org/", pic)
|
||||
print(f"####### Picture: {pic}", file=sys.stderr)
|
||||
print(f"####### User pp {user.profile_pic}", file=sys.stderr)
|
||||
|
||||
pic_needs_replacing = user.profile_pic is None or user.profile_pic == "" or \
|
||||
user.profile_pic.startswith("https://forum.minetest.net") or force_replace_pic
|
||||
if pic_needs_replacing and pic.startswith("https://forum.minetest.net"):
|
||||
user.profile_pic.startswith("https://forum.luanti.org") or force_replace_pic
|
||||
if pic_needs_replacing and pic.startswith("https://forum.luanti.org"):
|
||||
print(f"####### Queueing", file=sys.stderr)
|
||||
set_profile_picture_from_url.delay(user.username, pic)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ def update_package_scores():
|
||||
|
||||
|
||||
def desc_contains(desc: str, search_str: str):
|
||||
if search_str.startswith("https://forum.minetest.net/viewtopic.php?%t="):
|
||||
if search_str.startswith("https://forum.luanti.org/viewtopic.php?%t="):
|
||||
reg = re.compile(search_str.replace(".", "\\.").replace("/", "\\/").replace("?", "\\?").replace("%", ".*"))
|
||||
return reg.search(desc)
|
||||
else:
|
||||
@@ -58,7 +58,7 @@ def notify_about_git_forum_links():
|
||||
.filter(Package.repo.is_not(None), Package.state == PackageState.APPROVED).all()]
|
||||
for pair in db.session.query(Package, Package.forums) \
|
||||
.filter(Package.forums.is_not(None), Package.state == PackageState.APPROVED).all():
|
||||
package_links.append((pair[0], f"https://forum.minetest.net/viewtopic.php?%t={pair[1]}"))
|
||||
package_links.append((pair[0], f"https://forum.luanti.org/viewtopic.php?%t={pair[1]}"))
|
||||
|
||||
clauses = [and_(Package.id != pair[0].id, Package.desc.ilike(f"%{pair[1]}%")) for pair in package_links]
|
||||
packages = Package.query.filter(Package.desc != "", Package.desc.is_not(None), Package.state == PackageState.APPROVED, or_(*clauses)).all()
|
||||
|
||||
Reference in New Issue
Block a user