mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Support links to video hosts other than YouTube
This commit is contained in:
parent
8f2a87e5ed
commit
e20863a7e1
@ -89,7 +89,7 @@ Tokens can be attained by visiting [Settings > API Tokens](/user/tokens/).
|
|||||||
* `website`: Website URL.
|
* `website`: Website URL.
|
||||||
* `issue_tracker`: Issue tracker URL.
|
* `issue_tracker`: Issue tracker URL.
|
||||||
* `forums`: forum topic ID.
|
* `forums`: forum topic ID.
|
||||||
* `video_url`: URL to a video, YouTube only for now.
|
* `video_url`: URL to a video.
|
||||||
* GET `/api/packages/<username>/<name>/dependencies/`
|
* GET `/api/packages/<username>/<name>/dependencies/`
|
||||||
* Returns dependencies, with suggested candidates
|
* Returns dependencies, with suggested candidates
|
||||||
* If query argument `only_hard` is present, only hard deps will be returned.
|
* If query argument `only_hard` is present, only hard deps will be returned.
|
||||||
|
@ -61,7 +61,7 @@ It should be a JSON dictionary with one or more of the following optional keys:
|
|||||||
* `website`: Website URL.
|
* `website`: Website URL.
|
||||||
* `issue_tracker`: Issue tracker URL.
|
* `issue_tracker`: Issue tracker URL.
|
||||||
* `forums`: forum topic ID.
|
* `forums`: forum topic ID.
|
||||||
* `video_url`: URL to a video, YouTube only for now.
|
* `video_url`: URL to a video.
|
||||||
|
|
||||||
Use `null` to unset fields where relevant.
|
Use `null` to unset fields where relevant.
|
||||||
|
|
||||||
|
@ -131,9 +131,7 @@ def do_edit_package(user: User, package: Package, was_new: bool, was_web: bool,
|
|||||||
data["media_license"] = get_license(data["media_license"])
|
data["media_license"] = get_license(data["media_license"])
|
||||||
|
|
||||||
if "video_url" in data:
|
if "video_url" in data:
|
||||||
data["video_url"] = clean_youtube_url(data["video_url"])
|
data["video_url"] = clean_youtube_url(data["video_url"]) or data["video_url"]
|
||||||
if data["video_url"] is None:
|
|
||||||
raise LogicError(400, lazy_gettext("Video URL is not a YouTube video URL"))
|
|
||||||
|
|
||||||
for key in ["name", "title", "short_desc", "desc", "type", "dev_state", "license", "media_license",
|
for key in ["name", "title", "short_desc", "desc", "type", "dev_state", "license", "media_license",
|
||||||
"repo", "website", "issueTracker", "forums", "video_url"]:
|
"repo", "website", "issueTracker", "forums", "video_url"]:
|
||||||
|
@ -24,6 +24,8 @@ document.querySelectorAll(".video-embed").forEach(ele => {
|
|||||||
|
|
||||||
ele.setAttribute("data-src", href);
|
ele.setAttribute("data-src", href);
|
||||||
ele.removeAttribute("href");
|
ele.removeAttribute("href");
|
||||||
|
|
||||||
|
ele.querySelector(".label").innerText = "YouTube";
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(url);
|
console.error(url);
|
||||||
|
@ -47,11 +47,12 @@
|
|||||||
background: #111;
|
background: #111;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
|
flex-direction: column !important;
|
||||||
align-items: center !important;
|
align-items: center !important;
|
||||||
justify-content: center !important;
|
justify-content: center !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
.fas {
|
.fa-play {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 200%;
|
font-size: 200%;
|
||||||
color: #f44;
|
color: #f44;
|
||||||
@ -60,10 +61,18 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
background: #191919;
|
background: #191919;
|
||||||
|
|
||||||
.fas {
|
.fa-play {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.25rem;
|
||||||
|
right: 0.5rem;
|
||||||
|
color: #555;
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.screenshot-add {
|
.screenshot-add {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{% block title %}title{% endblock %} - {{ config.USER_APP_NAME }}</title>
|
<title>{% block title %}title{% endblock %} - {{ config.USER_APP_NAME }}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/libs/bootstrap.min.css">
|
<link rel="stylesheet" type="text/css" href="/static/libs/bootstrap.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/custom.css?v=33">
|
<link rel="stylesheet" type="text/css" href="/static/custom.css?v=34">
|
||||||
<link rel="search" type="application/opensearchdescription+xml" href="/static/opensearch.xml" title="ContentDB" />
|
<link rel="search" type="application/opensearchdescription+xml" href="/static/opensearch.xml" title="ContentDB" />
|
||||||
<link rel="shortcut icon" href="/favicon-16.png" sizes="16x16">
|
<link rel="shortcut icon" href="/favicon-16.png" sizes="16x16">
|
||||||
<link rel="icon" href="/favicon-128.png" sizes="128x128">
|
<link rel="icon" href="/favicon-128.png" sizes="128x128">
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
pattern="[0-9]+",
|
pattern="[0-9]+",
|
||||||
prefix="forum.minetest.net/viewtopic.php?t=",
|
prefix="forum.minetest.net/viewtopic.php?t=",
|
||||||
placeholder=_("Tip: paste in a forum topic URL")) }}
|
placeholder=_("Tip: paste in a forum topic URL")) }}
|
||||||
{{ render_field(form.video_url, class_="pkg_meta", hint=_("Only supports YouTube, for now")) }}
|
{{ render_field(form.video_url, class_="pkg_meta", hint=_("YouTube videos will be shown in an embed.")) }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="pkg_meta mt-5">{{ render_submit_field(form.submit) }}</div>
|
<div class="pkg_meta mt-5">{{ render_submit_field(form.submit) }}</div>
|
||||||
|
@ -252,8 +252,11 @@
|
|||||||
<ul class="gallery">
|
<ul class="gallery">
|
||||||
{% if package.video_url %}
|
{% if package.video_url %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ package.video_url }}" class="video-embed" title="{{ _('YouTube video embed') }}">
|
<a href="{{ package.video_url }}" class="video-embed">
|
||||||
<i class="fas fa-play"></i>
|
<i class="fas fa-play"></i>
|
||||||
|
<div class="label">
|
||||||
|
<i class="fas fa-external-link-square-alt"></i>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user