fixed html inline and slideshow frontend
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,2 +1,8 @@
|
||||
/pb_data/*
|
||||
/pb_data/**
|
||||
*.db
|
||||
*.jpeg
|
||||
*.mp4
|
||||
*.png
|
||||
/pb_data/storage/
|
||||
/pb_data/
|
||||
|
1
.idea/dbr-backend.iml
generated
1
.idea/dbr-backend.iml
generated
@ -8,5 +8,6 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="jquery-1.11.0" level="application" />
|
||||
</component>
|
||||
</module>
|
56
go.mod
56
go.mod
@ -2,18 +2,18 @@ module dbr-backend
|
||||
|
||||
go 1.19
|
||||
|
||||
require github.com/pocketbase/pocketbase v0.10.4
|
||||
require github.com/pocketbase/pocketbase v0.12.1-0.20230130105451-250642a8f97f
|
||||
|
||||
require (
|
||||
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.165 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.187 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.46 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.49 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
|
||||
@ -22,17 +22,17 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.22 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.28 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2 // indirect
|
||||
github.com/aws/smithy-go v1.13.5 // indirect
|
||||
github.com/disintegration/imaging v1.6.2 // indirect
|
||||
github.com/domodwyer/mailyak/v3 v3.3.4 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/fatih/color v1.14.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.1 // indirect
|
||||
github.com/ganigeorgiev/fexpr v0.1.1 // indirect
|
||||
github.com/ganigeorgiev/fexpr v0.3.0 // indirect
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
@ -45,34 +45,34 @@ require (
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.16 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/pocketbase/dbx v1.8.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect
|
||||
github.com/pocketbase/dbx v1.9.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230126093431-47fa9a501578 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.6.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
gocloud.dev v0.27.0 // indirect
|
||||
golang.org/x/crypto v0.4.0 // indirect
|
||||
golang.org/x/image v0.2.0 // indirect
|
||||
gocloud.dev v0.28.0 // indirect
|
||||
golang.org/x/crypto v0.5.0 // indirect
|
||||
golang.org/x/image v0.3.0 // indirect
|
||||
golang.org/x/mod v0.7.0 // indirect
|
||||
golang.org/x/net v0.4.0 // indirect
|
||||
golang.org/x/oauth2 v0.3.0 // indirect
|
||||
golang.org/x/net v0.5.0 // indirect
|
||||
golang.org/x/oauth2 v0.4.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.3.0 // indirect
|
||||
golang.org/x/term v0.3.0 // indirect
|
||||
golang.org/x/text v0.5.0 // indirect
|
||||
golang.org/x/sys v0.4.0 // indirect
|
||||
golang.org/x/term v0.4.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.4.0 // indirect
|
||||
golang.org/x/tools v0.5.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/api v0.105.0 // indirect
|
||||
google.golang.org/api v0.108.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
|
||||
google.golang.org/grpc v1.51.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa // indirect
|
||||
google.golang.org/grpc v1.52.3 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
@ -81,7 +81,7 @@ require (
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.5.0 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/sqlite v1.20.0 // indirect
|
||||
modernc.org/sqlite v1.20.3 // indirect
|
||||
modernc.org/strutil v1.1.3 // indirect
|
||||
modernc.org/token v1.1.0 // indirect
|
||||
)
|
||||
|
12
main.go
12
main.go
@ -6,6 +6,7 @@ import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -17,6 +18,17 @@ func main() {
|
||||
return nil
|
||||
})
|
||||
|
||||
app.OnFileDownloadRequest().Add(func(e *core.FileDownloadEvent) error {
|
||||
|
||||
if strings.HasSuffix(e.ServedPath, ".html") {
|
||||
e.HttpContext.Response().Header().Set("Content-Disposition", "inline")
|
||||
e.HttpContext.Response().Header().Set("Content-Security-Policy", "")
|
||||
}
|
||||
log.Println(e.ServedPath)
|
||||
log.Println(e.HttpContext)
|
||||
return nil
|
||||
})
|
||||
|
||||
if err := app.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
BIN
pb_data/data.db
BIN
pb_data/data.db
Binary file not shown.
BIN
pb_data/logs.db
BIN
pb_data/logs.db
Binary file not shown.
@ -1,10 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>$Title$</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link href="../css/uploadfile.css" rel="stylesheet">
|
||||
|
||||
<title>Medien hinzufügen</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="../css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="../css/icons/bootstrap-icons.css">
|
||||
<script src="../js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
$END$
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark rounded-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="dashboard.php">DBR</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="dashboard.php">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="addSlider.php">Medien hinzufügen</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="listSlider.php">Datein verwalten</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="d-flex">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php">Ausloggen <i
|
||||
class="bi-box-arrow-right text-light"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<div class="container d-grid gap-3">
|
||||
<div class="p-2 bg-light border">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="basic-addon1">Gruppe</span>
|
||||
<input type="text" id="group" class="form-control" placeholder="Gruppe" aria-label="Gruppe"
|
||||
aria-describedby="basic-addon1" value="">
|
||||
</div>
|
||||
|
||||
<div id="mulitplefileuploader">Upload</div>
|
||||
<div id="status"></div>
|
||||
|
||||
</div>
|
||||
<div class="p-2 bg-light border">
|
||||
<p class="card-text">
|
||||
<h3>Erlaubte Inhalte:</h3>
|
||||
'png', 'jpg', 'jpeg', 'gif', 'html', 'mp4', 'avi'
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../js/jquery-1.11.0.js"></script>
|
||||
<script src="../js/jquery.uploadfile.min.js"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
const settings = {
|
||||
url: "/api/collections/media/records",
|
||||
method: "POST",
|
||||
allowedTypes: "jpg,png,gif,doc,pdf,zip,mp4,html,jpeg,avi",
|
||||
fileName: "media",
|
||||
formData: {
|
||||
"group": function () {
|
||||
return document.getElementById("group").value
|
||||
},
|
||||
"duration": "7000",
|
||||
"enabled": true
|
||||
},
|
||||
multiple: true,
|
||||
onSuccess: function (files, data, xhr) {
|
||||
$("#status").html("<font color='green'>Upload is success</font>");
|
||||
|
||||
},
|
||||
onError: function (files, status, errMsg) {
|
||||
$("#status").html("<font color='red'>Upload is Failed</font>");
|
||||
}
|
||||
};
|
||||
$("#mulitplefileuploader").uploadFile(settings);
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -45,23 +45,28 @@
|
||||
|
||||
<script type="module">
|
||||
import PocketBase from './js/pocketbase/pocketbase.esm.js'
|
||||
|
||||
const sliderArrayQuery = [];
|
||||
|
||||
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||
|
||||
const media = pb.collection('media').getFullList(200, {
|
||||
const media = pb.collection('media').getFullList(2000, {
|
||||
sort: '-created',
|
||||
});
|
||||
|
||||
media.then(
|
||||
it => it.forEach((arrObj) => {
|
||||
sliderArrayQuery.push(new Slider(arrObj.collectionId, arrObj.collectionName, arrObj.created, arrObj.duration, arrObj.enabled, arrObj.id, arrObj.media, arrObj.updated))
|
||||
media.then(
|
||||
it => it.forEach((arrObj) => {
|
||||
sliderArrayQuery.push(new Slider(arrObj.collectionId, arrObj.collectionName, arrObj.created, arrObj.duration, arrObj.enabled, arrObj.id, arrObj.media, arrObj.updated))
|
||||
})
|
||||
).then(_ => {
|
||||
let sliderArray = sliderArrayQuery.filter(mediaObjekt => {
|
||||
return mediaObjekt.enabled === true
|
||||
})
|
||||
let slideshow = new Slideshow('#image_container', sliderArray, '', true, true, 0)
|
||||
startSlideShow(slideshow)
|
||||
})
|
||||
;
|
||||
|
||||
let sliderArray = sliderArrayQuery.filter(mediaObjekt => {return mediaObjekt.enabled === true})
|
||||
let slideshow = new Slideshow('#image_container', sliderArray, '', true, true, 0)
|
||||
startSlideShow(slideshow)
|
||||
})
|
||||
);
|
||||
</script>
|
||||
<script src="js/slideshow.js"></script>
|
||||
|
||||
|
@ -126,7 +126,7 @@ class MultipleUploader {
|
||||
|
||||
for (const [ index, file] of Object.entries( this.#$imagesUploadInput.files ))
|
||||
{
|
||||
if ( index != deletedIndex )
|
||||
if ( index !== deletedIndex )
|
||||
dt.items.add( file )
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ function show() {
|
||||
|
||||
if (slideshow.sliderArray[counter].media.endsWith('.html')) {
|
||||
wrapper.style.backgroundImage = ``;
|
||||
wrapper.id = "test";
|
||||
wrapper.id = "image";
|
||||
const makeIframe = document.createElement("iframe");
|
||||
makeIframe.setAttribute('src', "/api/files/" + slideshow.sliderArray[counter].collectionId + "/" + slideshow.sliderArray[counter].id + "/" + slideshow.sliderArray[counter].media);
|
||||
makeIframe.setAttribute("scrolling", "no");
|
||||
@ -127,6 +127,9 @@ function show() {
|
||||
makeIframe.style.height = "100vh";
|
||||
makeIframe.style.overflow = "hidden";
|
||||
makeIframe.style.border = "none";
|
||||
makeIframe.style.position = "relative";
|
||||
makeIframe.style.zIndex = "7";
|
||||
wrapper_blur.style.height = "0";
|
||||
|
||||
if (wrapper.dataset.loaded === 'false') {
|
||||
wrapper.dataset.loaded = 'true';
|
||||
@ -136,6 +139,7 @@ function show() {
|
||||
} else {
|
||||
if (slideshow.sliderArray[counter].media.endsWith('.mp4')) {
|
||||
wrapper.style.backgroundImage = ``;
|
||||
wrapper.id = "image";
|
||||
const vid = document.createElement('video');
|
||||
vid.setAttribute('loop', 'true');
|
||||
vid.setAttribute('autoplay', 'true');
|
||||
@ -154,6 +158,8 @@ function show() {
|
||||
}
|
||||
} else {
|
||||
wrapper.innerHTML = ' ';
|
||||
wrapper.id = "image";
|
||||
wrapper_blur.style.height = "100%";
|
||||
let url = '/api/files/' + slideshow.sliderArray[counter].collectionId + "/" + slideshow.sliderArray[counter].id + "/" + slideshow.sliderArray[counter].media;
|
||||
let i = new Image();
|
||||
i.src = url;
|
||||
|
Reference in New Issue
Block a user