mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 14:02:24 +01:00
Add forum_url to API, change to forum.luanti.org
This commit is contained in:
parent
dd2e73b40f
commit
a54104aa82
@ -77,7 +77,7 @@ def claim_forums():
|
||||
|
||||
# Get signature
|
||||
try:
|
||||
profile = get_profile("https://forum.minetest.net", username)
|
||||
profile = get_profile("https://forum.luanti.org", username)
|
||||
sig = profile.signature if profile else None
|
||||
except IOError as e:
|
||||
if hasattr(e, 'message'):
|
||||
|
@ -78,6 +78,9 @@ curl -X DELETE https://content.luanti.org/api/delete-token/ \
|
||||
* GET `/api/packages/` (List)
|
||||
* See [Package Queries](#package-queries)
|
||||
* GET `/api/packages/<username>/<name>/` (Read)
|
||||
* Redirects a JSON object with the keys documented by the PUT endpoint, below.
|
||||
* Plus:
|
||||
* `forum_url`: String or null.
|
||||
* PUT `/api/packages/<author>/<name>/` (Update)
|
||||
* Requires authentication.
|
||||
* JSON object with any of these keys (all are optional, null to delete Nullables):
|
||||
|
@ -158,7 +158,7 @@ class ForumTopic(db.Model):
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return "https://forum.minetest.net/viewtopic.php?t=" + str(self.topic_id)
|
||||
return "https://forum.luanti.org/viewtopic.php?t=" + str(self.topic_id)
|
||||
|
||||
def get_repo_url(self):
|
||||
if self.link is None:
|
||||
|
@ -457,7 +457,7 @@ class Package(db.Model):
|
||||
if self.forums is None:
|
||||
return None
|
||||
|
||||
return "https://forum.minetest.net/viewtopic.php?t=" + str(self.forums)
|
||||
return "https://forum.luanti.org/viewtopic.php?t=" + str(self.forums)
|
||||
|
||||
enable_game_support_detection = db.Column(db.Boolean, nullable=False, default=True)
|
||||
|
||||
@ -679,6 +679,7 @@ class Package(db.Model):
|
||||
"website": self.website,
|
||||
"issue_tracker": self.issueTracker,
|
||||
"forums": self.forums,
|
||||
"forum_url": self.forums_url,
|
||||
"video_url": self.video_url,
|
||||
"video_thumbnail_url": self.get_video_thumbnail_url(True),
|
||||
"donate_url": self.donate_url_actual,
|
||||
|
@ -26,7 +26,7 @@ window.addEventListener("load", () => {
|
||||
try {
|
||||
const pasteData = e.clipboardData.getData('text');
|
||||
const url = new URL(pasteData);
|
||||
if (url.hostname === "forum.minetest.net") {
|
||||
if (url.hostname === "forum.luanti.org") {
|
||||
forumsField.value = url.searchParams.get("t");
|
||||
e.preventDefault();
|
||||
}
|
||||
@ -37,7 +37,7 @@ window.addEventListener("load", () => {
|
||||
|
||||
const openForums = document.getElementById("forums-button");
|
||||
openForums.addEventListener("click", () => {
|
||||
window.open("https://forum.minetest.net/viewtopic.php?t=" + forumsField.value, "_blank");
|
||||
window.open("https://forum.luanti.org/viewtopic.php?t=" + forumsField.value, "_blank");
|
||||
});
|
||||
|
||||
function setupHints(id, hints) {
|
||||
|
@ -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()
|
||||
|
@ -14,7 +14,7 @@
|
||||
[{{ topic.type.text }}]
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
||||
<a href="https://forum.luanti.org/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
||||
{% if topic.wip %}[{{ _("WIP") }}]{% endif %}
|
||||
</td>
|
||||
{% if show_author %}
|
||||
@ -42,7 +42,7 @@
|
||||
{% macro render_topics(topics, current_user) -%}
|
||||
<div class="list-group">
|
||||
{% for topic in topics %}
|
||||
<a class="list-group-item list-group-item-action" href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">
|
||||
<a class="list-group-item list-group-item-action" href="https://forum.luanti.org/viewtopic.php?t={{ topic.topic_id}}">
|
||||
<span class="float-end text-muted">
|
||||
{{ topic.created_at | date }}
|
||||
</span>
|
||||
|
@ -23,7 +23,7 @@
|
||||
{% for t in similar_topics %}
|
||||
<li>
|
||||
[{{ t.type.text }}]
|
||||
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
|
||||
<a href="https://forum.luanti.org/viewtopic.php?t={{ t.topic_id }}">
|
||||
{{ _("%(title)s by %(display_name)s", title=t.title, display_name=t.author.display_name) }}
|
||||
</a>
|
||||
{% if t.wip %}[{{ _("WIP") }}]{% endif %}
|
||||
|
@ -137,7 +137,7 @@
|
||||
{{ render_field(form.issueTracker, class_="pkg_meta", hint=_("Where should users report issues?")) }}
|
||||
{{ render_field_prefix_button(form.forums, class_="pkg_meta",
|
||||
pattern="[0-9]+",
|
||||
prefix="forum.minetest.net/viewtopic.php?t=",
|
||||
prefix="forum.luanti.org/viewtopic.php?t=",
|
||||
placeholder=_("Paste a forum topic URL"),
|
||||
has_view=True) }}
|
||||
{{ render_field(form.video_url, class_="pkg_meta", hint=_("YouTube videos will be shown in an embed.")) }}
|
||||
|
@ -34,7 +34,7 @@
|
||||
{% for t in similar_topics %}
|
||||
<li>
|
||||
[{{ t.type.value }}]
|
||||
<a href="https://forum.minetest.net/viewtopic.php?t={{ t.topic_id }}">
|
||||
<a href="https://forum.luanti.org/viewtopic.php?t={{ t.topic_id }}">
|
||||
{{ _("%(title)s by %(display_name)s", title=t.title, display_name=t.author.display_name) }}
|
||||
</a>
|
||||
{% if t.wip %}[{{ _("WIP") }}]{% endif %}
|
||||
|
@ -5,7 +5,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block ruben_link %}
|
||||
<a href="https://forum.minetest.net/ucp.php?i=pm&mode=compose&u=2051">rubenwardy</a>
|
||||
<a href="https://forum.luanti.org/ucp.php?i=pm&mode=compose&u=2051">rubenwardy</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block pane %}
|
||||
@ -36,7 +36,7 @@
|
||||
<td>Forums</td>
|
||||
<td>
|
||||
{% if user.forums_username %}
|
||||
<a href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
|
||||
<a href="https://forum.luanti.org/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
|
||||
{{ user.forums_username }}
|
||||
</a>
|
||||
{% else %}
|
||||
|
@ -16,7 +16,7 @@
|
||||
hint=_("Your email is needed to recover your account if you forget your password and to send (configurable) notifications. ") +
|
||||
_("Your email will never be shared with a third-party.")) }}
|
||||
<p>
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.minetest.net/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.luanti.org/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
<a class="btn btn-primary me-3" href="{{ url_for('users.register') }}">
|
||||
{{ _("<b>No</b>, I don't have one") }}
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="https://forum.minetest.net/ucp.php?mode=register">
|
||||
<a class="btn btn-secondary" href="https://forum.luanti.org/ucp.php?mode=register">
|
||||
{{ _("Create forum account") }}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -41,7 +41,7 @@ Create Account from Forums User
|
||||
|
||||
<p>
|
||||
{{ _("You'll need to have the GitHub field in your forum profile filled out.") }}
|
||||
{{ _("Log into the forum and <a href='https://forum.minetest.net/ucp.php?i=173'>do that here</a>.") }}
|
||||
{{ _("Log into the forum and <a href='https://forum.luanti.org/ucp.php?i=173'>do that here</a>.") }}
|
||||
</p>
|
||||
|
||||
<input class="btn btn-primary" type="submit" value="{{ _('Next: log in with GitHub') }}">
|
||||
@ -68,7 +68,7 @@ Create Account from Forums User
|
||||
placeholder="{{ _('Forum username') }}" pattern="[a-zA-Z0-9._ -]+" title="{{ _('Only a-zA-Z0-9._ allowed') }}" required>
|
||||
|
||||
<p>
|
||||
{{ _("Go to <a href='https://forum.minetest.net/ucp.php?i=profile&mode=signature'>User Control Panel > Profile > Edit signature</a>") }}
|
||||
{{ _("Go to <a href='https://forum.luanti.org/ucp.php?i=profile&mode=signature'>User Control Panel > Profile > Edit signature</a>") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -71,7 +71,7 @@
|
||||
</span>
|
||||
|
||||
{% if user.forums_username %}
|
||||
<a class="btn" href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
|
||||
<a class="btn" href="https://forum.luanti.org/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
|
||||
<i class="fas fa-comments"></i>
|
||||
<span class="count">
|
||||
{{ _("Forums") }}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
{% if user.forums_username %}
|
||||
<a href="https://forum.minetest.net/ucp.php?i=profile&mode=avatar">
|
||||
<a href="https://forum.luanti.org/ucp.php?i=profile&mode=avatar">
|
||||
{% elif user.email %}
|
||||
<a href="https://en.gravatar.com/">
|
||||
{% endif %}
|
||||
|
@ -24,7 +24,7 @@
|
||||
hint=_("Your email is needed to recover your account if you forget your password and to send (configurable) notifications. ") +
|
||||
_("Your email will never be shared with a third-party.")) }}
|
||||
<p>
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.minetest.net/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.luanti.org/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
</p>
|
||||
|
||||
{{ render_field(form.password, hint=_("Must be at least 12 characters long.")) }}
|
||||
|
@ -24,7 +24,7 @@
|
||||
{{ _("Your email will never be shared with a third-party.") }}
|
||||
</p>
|
||||
<p>
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.minetest.net/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
{{ _("Note: protonmail is unsupported by ContentDB. <a href='https://forum.luanti.org/viewtopic.php?t=30709'>More info</a>.") }}
|
||||
</p>
|
||||
|
||||
{% if user.email_verifications.filter_by(is_password_reset=False).count() > 0 %}
|
||||
|
@ -124,7 +124,7 @@ def parse_forum_list_page(id, page, out, extra=None):
|
||||
start = page*num_per_page+1
|
||||
print(" - Fetching page {} (topics {}-{})".format(page, start, start+num_per_page), file=sys.stderr)
|
||||
|
||||
url = "https://forum.minetest.net/viewforum.php?f=" + str(id) + "&start=" + str(start)
|
||||
url = "https://forum.luanti.org/viewforum.php?f=" + str(id) + "&start=" + str(start)
|
||||
r = urllib.request.urlopen(url).read().decode("utf-8")
|
||||
soup = BeautifulSoup(r, "html.parser")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user