Merge branch 'branch-2.10'
This commit is contained in:
commit
e753a68e76
5 changed files with 40 additions and 60 deletions
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
|
@ -31,35 +31,11 @@ jobs:
|
||||||
zip -r shimmie2-${{ steps.get_version.outputs.VERSION }}.zip shimmie2
|
zip -r shimmie2-${{ steps.get_version.outputs.VERSION }}.zip shimmie2
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
uses: softprops/action-gh-release@v1
|
||||||
uses: actions/create-release@latest
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
release_name: Shimmie ${{ steps.get_version.outputs.VERSION }}
|
name: Shimmie ${{ steps.get_version.outputs.VERSION }}
|
||||||
body: Automated release from tags
|
body: Automated release from tags
|
||||||
draft: false
|
files: |
|
||||||
prerelease: false
|
../shimmie2-${{ steps.get_version.outputs.VERSION }}.zip
|
||||||
|
../shimmie2-${{ steps.get_version.outputs.VERSION }}.tgz
|
||||||
- name: Upload Zip
|
|
||||||
id: upload-release-asset-zip
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ../shimmie2-${{ steps.get_version.outputs.VERSION }}.zip
|
|
||||||
asset_name: shimmie2-${{ steps.get_version.outputs.VERSION }}.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
- name: Upload Tar
|
|
||||||
id: upload-release-asset-tar
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ../shimmie2-${{ steps.get_version.outputs.VERSION }}.tgz
|
|
||||||
asset_name: shimmie2-${{ steps.get_version.outputs.VERSION }}.tgz
|
|
||||||
asset_content_type: application/gzip
|
|
||||||
|
|
|
@ -383,8 +383,6 @@ class BasePage
|
||||||
$data_href = get_base_href();
|
$data_href = get_base_href();
|
||||||
$theme_name = $config->get_string(SetupConfig::THEME, 'default');
|
$theme_name = $config->get_string(SetupConfig::THEME, 'default');
|
||||||
|
|
||||||
$this->add_html_header("<script type='text/javascript'>base_href = '$data_href';</script>", 40);
|
|
||||||
|
|
||||||
# static handler will map these to themes/foo/static/bar.ico or ext/static_files/static/bar.ico
|
# static handler will map these to themes/foo/static/bar.ico or ext/static_files/static/bar.ico
|
||||||
$this->add_html_header("<link rel='icon' type='image/x-icon' href='$data_href/favicon.ico'>", 41);
|
$this->add_html_header("<link rel='icon' type='image/x-icon' href='$data_href/favicon.ico'>", 41);
|
||||||
$this->add_html_header("<link rel='apple-touch-icon' href='$data_href/apple-touch-icon.png'>", 42);
|
$this->add_html_header("<link rel='apple-touch-icon' href='$data_href/apple-touch-icon.png'>", 42);
|
||||||
|
@ -558,6 +556,7 @@ class BasePage
|
||||||
|
|
||||||
$body_attrs = [
|
$body_attrs = [
|
||||||
"data-userclass" => $user->class->name,
|
"data-userclass" => $user->class->name,
|
||||||
|
"data-base-href" => get_base_href(),
|
||||||
];
|
];
|
||||||
|
|
||||||
print emptyHTML(
|
print emptyHTML(
|
||||||
|
|
|
@ -42,7 +42,7 @@ function updateCompletions(element) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
element.completer_timeout = setTimeout(() => {
|
element.completer_timeout = setTimeout(() => {
|
||||||
fetch(base_href + '/api/internal/autocomplete?s=' + word).then(
|
fetch(document.body.getAttribute("data-base-href") + '/api/internal/autocomplete?s=' + word).then(
|
||||||
(response) => response.json()
|
(response) => response.json()
|
||||||
).then((json) => {
|
).then((json) => {
|
||||||
if(element.selected_completion !== -1) {
|
if(element.selected_completion !== -1) {
|
||||||
|
@ -232,16 +232,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
highlightCompletion(element, element.selected_completion+1);
|
highlightCompletion(element, element.selected_completion+1);
|
||||||
}
|
}
|
||||||
// if enter or right are pressed, add the selected completion
|
// if enter or right are pressed while a completion is selected, add the selected completion
|
||||||
else if((event.code === "Enter" || event.code == "ArrowRight") && element.selected_completion !== -1) {
|
else if((event.code === "Enter" || event.code == "ArrowRight") && element.selected_completion !== -1) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setCompletion(element, Object.keys(element.completions)[element.selected_completion]);
|
setCompletion(element, Object.keys(element.completions)[element.selected_completion]);
|
||||||
}
|
}
|
||||||
// If enter is pressed while nothing is selected, submit the form
|
|
||||||
else if(event.code === "Enter" && element.selected_completion === -1) {
|
|
||||||
event.preventDefault();
|
|
||||||
element.form.submit();
|
|
||||||
}
|
|
||||||
// if escape is pressed, hide the completion block
|
// if escape is pressed, hide the completion block
|
||||||
else if(event.code === "Escape") {
|
else if(event.code === "Escape") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
30
ext/handle_mp3/script.js
Normal file
30
ext/handle_mp3/script.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
let main_image = document.getElementById("main_image");
|
||||||
|
if (main_image) {
|
||||||
|
main_image.setAttribute("volume", 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
let base_href = document.body.getAttribute("data-base-href");
|
||||||
|
let audio_src = document.getElementById("audio_src");
|
||||||
|
if (audio_src) {
|
||||||
|
let ilink = audio_src.getAttribute("src");
|
||||||
|
window.jsmediatags.read(location.origin + base_href + ilink, {
|
||||||
|
onSuccess: function (tag) {
|
||||||
|
var artist = tag.tags.artist,
|
||||||
|
title = tag.tags.title;
|
||||||
|
|
||||||
|
document.getElementById("audio-title").innerText = title;
|
||||||
|
document.getElementById("audio-artist").innerText = artist;
|
||||||
|
document
|
||||||
|
.getElementById("audio-download")
|
||||||
|
.setAttribute(
|
||||||
|
"download",
|
||||||
|
(artist + " - " + title).substring(0, 250) + ".mp3",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onError: function (error) {
|
||||||
|
console.log(error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
|
@ -13,31 +13,11 @@ class MP3FileHandlerTheme extends Themelet
|
||||||
$ilink = $image->get_image_link();
|
$ilink = $image->get_image_link();
|
||||||
$html = "
|
$html = "
|
||||||
<audio controls class='shm-main-image audio_image' id='main_image' alt='main image'>
|
<audio controls class='shm-main-image audio_image' id='main_image' alt='main image'>
|
||||||
<source src=\"$ilink\" type=\"audio/mpeg\">
|
<source id='audio_src' src=\"$ilink\" type=\"audio/mpeg\">
|
||||||
Your browser does not support the audio element.
|
Your browser does not support the audio element.
|
||||||
</audio>
|
</audio>
|
||||||
<p>Title: <span id='audio-title'>???</span> | Artist: <span id='audio-artist'>???</span></p>
|
<p>Title: <span id='audio-title'>???</span> | Artist: <span id='audio-artist'>???</span></p>
|
||||||
|
|
||||||
<script>
|
|
||||||
$('#main_image').prop('volume', 0.25);
|
|
||||||
|
|
||||||
var jsmediatags = window.jsmediatags;
|
|
||||||
jsmediatags.read(location.origin+base_href+'$ilink', {
|
|
||||||
onSuccess: function(tag) {
|
|
||||||
var artist = tag.tags.artist,
|
|
||||||
title = tag.tags.title;
|
|
||||||
|
|
||||||
$('#audio-title').text(title);
|
|
||||||
$('#audio-artist').text(artist);
|
|
||||||
|
|
||||||
$('#audio-download').prop('download', (artist+' - '+title).substr(0, 250)+'.mp3');
|
|
||||||
},
|
|
||||||
onError: function(error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p><a href='$ilink' id='audio-download'>Download</a>";
|
<p><a href='$ilink' id='audio-download'>Download</a>";
|
||||||
|
|
||||||
$page->add_html_header("<script src='{$data_href}/ext/handle_mp3/lib/jsmediatags.min.js' type='text/javascript'></script>");
|
$page->add_html_header("<script src='{$data_href}/ext/handle_mp3/lib/jsmediatags.min.js' type='text/javascript'></script>");
|
||||||
|
|
Reference in a new issue