Fehlermeldungen hinzugefügt, wenn Verbindung zur API nicht klappt

This commit is contained in:
R40fendt
2026-01-28 18:43:30 +01:00
parent 59e2a2693c
commit f04b4089f7
27 changed files with 194 additions and 137 deletions

0
src-tauri/icons/128x128.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

0
src-tauri/icons/128x128@2x.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

0
src-tauri/icons/32x32.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 974 B

0
src-tauri/icons/Square107x107Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

0
src-tauri/icons/Square142x142Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

0
src-tauri/icons/Square150x150Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
src-tauri/icons/Square284x284Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

0
src-tauri/icons/Square30x30Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 903 B

0
src-tauri/icons/Square310x310Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

0
src-tauri/icons/Square44x44Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

0
src-tauri/icons/Square71x71Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
src-tauri/icons/Square89x89Logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
src-tauri/icons/StoreLogo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
src-tauri/icons/icon.icns Normal file → Executable file
View File

0
src-tauri/icons/icon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

0
src-tauri/icons/icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -25,11 +25,7 @@
"active": true, "active": true,
"targets": "all", "targets": "all",
"icon": [ "icon": [
"icons/32x32.png", "icons/icon.png"
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
] ]
} }
} }

View File

@@ -3,9 +3,10 @@ import { useRouter } from "vue-router";
class AdminPanelLib { class AdminPanelLib {
router=useRouter();
static async getUserInfo(token:string){ static async getUserInfo(token:string){
if(!await RitzenbergenLib.RitzenbergenLib.checkInternetConnection()) return false;
const url=new URL(RitzenbergenLib.RitzenbergenLib.api("/admin/userinfo.php")); const url=new URL(RitzenbergenLib.RitzenbergenLib.api("/admin/userinfo.php"));
return fetch(url.toString(), { return fetch(url.toString(), {
headers: { headers: {

View File

@@ -23,7 +23,7 @@ export default {
parseInt(localStorage.getItem("kloenkasten_last_opened")) parseInt(localStorage.getItem("kloenkasten_last_opened"))
); );
const lastMsg = this.messages[this.messages.length - 1]; const lastMsg = this.messages[this.messages.length - 1];
if (lastMsg.timestamp > lastOpened) { if (this.messages && lastMsg.timestamp > lastOpened) {
return true; return true;
} }
return false; return false;
@@ -60,7 +60,7 @@ export default {
"kloenkasten_last_opened", "kloenkasten_last_opened",
Date.now().toString() Date.now().toString()
); );
window.setTimeout( if(this.messages) window.setTimeout(
() => () =>
this.msgrefs[this.msgrefs.length - 1].scrollIntoView({ this.msgrefs[this.msgrefs.length - 1].scrollIntoView({
behavior: "smooth", behavior: "smooth",
@@ -78,13 +78,19 @@ export default {
) )
); );
return fetch(url.toString(), { method: "GET" }) return fetch(url.toString(), { method: "GET" })
.then((response) => response.json()) .then((response)=>{
if(response.ok) return response.json();
else throw new Error("fetch "+response.status);
})
.then((data) => .then((data) =>
data.map((msg) => { data.map((msg) => {
msg.timestamp = new Date(msg.timestamp); msg.timestamp = new Date(msg.timestamp);
return msg; return msg;
}) })
); ).catch(()=>{
return false;
});
}, },
watch: ["reloader"], watch: ["reloader"],
}, },
@@ -108,7 +114,7 @@ export default {
<span id="close-button" @click="opened = false">&times;</span> <span id="close-button" @click="opened = false">&times;</span>
</div> </div>
<div id="chat-messages"> <div id="chat-messages" v-if="messages">
<div <div
v-for="(msg, i) in messages" v-for="(msg, i) in messages"
:key="i" :key="i"
@@ -154,6 +160,10 @@ export default {
<input type="submit" id="send-button" value="Senden" /> <input type="submit" id="send-button" value="Senden" />
</form> </form>
</div> </div>
<div id="chat-messages" v-else>
<h3>Konnte Server nicht erreichen.</h3>
</div>
</div> </div>
</template> </template>
<style scoped> <style scoped>

View File

@@ -69,7 +69,7 @@ export default {
</div> </div>
<div class="col-12 mt-4"> <div class="col-12 mt-4">
<p class="mbr-fonts-style copyright display-7"> <p class="mbr-fonts-style copyright display-7">
© 2025 Ritzenbergen. Alle Rechte vorbehalten. <br /> © 2026 Ritzenbergen. Alle Rechte vorbehalten. <br />
</p> </p>
</div> </div>
</div> </div>

View File

@@ -1,90 +1,111 @@
<script lang="ts"> <script lang="ts" setup>
import RitzenbergenLib from "../../ritzenbergenlib.ts"; import RitzenbergenLib from "../../ritzenbergenlib.ts";
export default { import {ref} from "vue";
data() {
return { async function loadImage(path: string) {
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib try{
}; const response = await fetch(RitzenbergenLib.RitzenbergenLib.api(path), {
} headers: {
}; "Accept":"image/png"
}
});
if(!response.ok) return false;
const blob = await response.blob();
return URL.createObjectURL(blob);
}
catch(e){
console.warn(e);
}
}
loadImage("randomimage.php?path=/doppelkopf&recursive=1&tn=1&color=white&text=Doppelkopf&size=3").then((url)=>{
images.value[0]=url;
});
loadImage("randomimage.php?path=/erntefest&recursive=1&tn=1&color=white&text=Erntefest&size=3").then((url)=>{
images.value[1]=url;
});
loadImage("randomimage.php?path=/fussball&recursive=1&tn=1&color=white&text=Fußballturnier&size=3").then((url)=>{
images.value[2]=url;
});
loadImage("randomimage.php?path=/osterfeuer&recursive=1&tn=1&color=white&text=Osterfeuer&size=3").then((url)=>{
images.value[3]=url;
});
const images=ref([]);
</script> </script>
<template> <template>
<section class="gallery09 cid-u6k7q0xbqP" id="gallery-9-u6k7q0xbqP"> <section
<div class="container"> class="gallery09 cid-u6k7q0xbqP"
<div class="row justify-content-center"> id="gallery-9-u6k7q0xbqP"
<div class="col-12 col-md-12 col-lg-4 main-text"> v-if="images[0]"
<div class=""> >
<h5 class="mbr-section-title mbr-fonts-style mt-0 mb-4 display-2"> <div class="container">
<strong>Bilderbuch Ritzenbergen</strong> <div class="row justify-content-center">
</h5> <div class="col-12 col-md-12 col-lg-4 main-text">
<h6 <div class="">
class="mbr-section-subtitle mbr-fonts-style mt-0 mb-4 display-7" <h5
> class="mbr-section-title mbr-fonts-style mt-0 mb-4 display-2"
Klicke auf ein Bild um in unsere Galerie zu gelangen. Die Bilder >
sind nach Jahreszahl und Kategorie geordnet. <strong>Bilderbuch Ritzenbergen</strong>
</h6> </h5>
</div> <h6
</div> class="mbr-section-subtitle mbr-fonts-style mt-0 mb-4 display-7"
<div class="col-lg-8 side-features row"> >
<div class="item features-image col-12 col-md-6 col-lg-6 active"> Klicke auf ein Bild um in unsere Galerie zu
<div class="item-wrapper"> gelangen. Die Bilder sind nach Jahreszahl und
<div class="item-img"> Kategorie geordnet.
<RouterLink to="/galerie/doppelkopf" </h6>
><img </div>
:src=" </div>
RitzenbergenLib.api( <div class="col-lg-8 side-features row">
'randomimage.php?path=/doppelkopf&recursive=1&tn=1&color=white&text=Doppelkopf&size=3' <div
) class="item features-image col-12 col-md-6 col-lg-6 active"
" >
/></RouterLink> <div class="item-wrapper">
</div> <div class="item-img">
</div> <RouterLink to="/galerie/doppelkopf"
</div> ><img :src="images[0]"
<div class="item features-image col-12 col-md-6 col-lg-6 active"> /></RouterLink>
<div class="item-wrapper"> </div>
<div class="item-img"> </div>
<RouterLink to="/galerie/erntefest" </div>
><img <div
:src=" class="item features-image col-12 col-md-6 col-lg-6 active"
RitzenbergenLib.api( >
'randomimage.php?path=/erntefest&recursive=1&tn=1&color=white&text=Erntefest&size=3' <div class="item-wrapper">
) <div class="item-img">
" <RouterLink to="/galerie/erntefest"
/></RouterLink> ><img :src="images[1]"
</div> /></RouterLink>
</div> </div>
</div> </div>
<div class="item features-image col-12 col-md-6 col-lg-6 active"> </div>
<div class="item-wrapper"> <div
<div class="item-img"> class="item features-image col-12 col-md-6 col-lg-6 active"
<RouterLink to="/galerie/fussball" >
><img <div class="item-wrapper">
:src=" <div class="item-img">
RitzenbergenLib.api( <RouterLink to="/galerie/fussball"
'randomimage.php?path=/fussball&recursive=1&tn=1&color=white&text=Fußballturnier&size=3' ><img :src="images[2]"
) /></RouterLink>
" </div>
/></RouterLink> </div>
</div> </div>
</div> <div
</div> class="item features-image col-12 col-md-6 col-lg-6 active"
<div class="item features-image col-12 col-md-6 col-lg-6 active"> >
<div class="item-wrapper"> <div class="item-wrapper">
<div class="item-img"> <div class="item-img">
<RouterLink to="/galerie/osterfeuer" <RouterLink to="/galerie/osterfeuer"
><img ><img :src="images[3]"
:src=" /></RouterLink>
RitzenbergenLib.api( </div>
'randomimage.php?path=/osterfeuer&recursive=1&tn=1&color=white&text=Osterfeuer&size=3' </div>
) </div>
" </div>
/></RouterLink> </div>
</div> </div>
</div> </section>
</div>
</div>
</div>
</div>
</section>
</template> </template>
<style></style> <style></style>

View File

@@ -27,6 +27,9 @@ export default {
success: function (data: string) { success: function (data: string) {
result = JSON.parse(data); result = JSON.parse(data);
}, },
error: function () {
result=false;
}
}); });
return result; return result;
/* /*
@@ -130,7 +133,7 @@ export default {
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row" v-if="events">
<!-- Events --> <!-- Events -->
<h5 class="align-center" v-if="events.length == 0"> <h5 class="align-center" v-if="events.length == 0">
@@ -217,6 +220,10 @@ export default {
</div> </div>
</div> </div>
</div> </div>
<div class="row" v-else>
<h1>Keine Internetverbindung!</h1>
</div>
</div> </div>
</section> </section>
</template> </template>

View File

@@ -50,6 +50,13 @@ class RitzenbergenLib {
return apiBaseUrl + path; return apiBaseUrl + path;
else return apiBaseUrl+"/" + path; else return apiBaseUrl+"/" + path;
} }
static async checkInternetConnection(): Promise<boolean> {
try{
return await fetch(this.api("/addhit.php")).then((response)=>response.ok);
} catch(e){
return false;
}
}
} }
class Paarung { class Paarung {
@@ -171,6 +178,7 @@ class Formular {
} }
public static async getForms(): Promise<Formular[]> { public static async getForms(): Promise<Formular[]> {
let forms: Formular[] = []; let forms: Formular[] = [];
try{
forms = await fetch( forms = await fetch(
RitzenbergenLib.api("/formulare/get_formulare.php"), RitzenbergenLib.api("/formulare/get_formulare.php"),
{ {
@@ -191,6 +199,9 @@ class Formular {
) )
); );
} catch(e){
console.warn(e);
}
return forms; return forms;
} }
private async getFields(): Promise<Field[]> { private async getFields(): Promise<Field[]> {

View File

@@ -26,6 +26,11 @@ export default {
Tippen, Tippen,
TippenEinloggen TippenEinloggen
}, },
created(){
RitzenbergenLib.RitzenbergenLib.checkInternetConnection().then((result)=>{
if(!result) this.$router.push("/");
});
},
asyncComputed: { asyncComputed: {
users: { users: {
get(){ get(){

View File

@@ -17,7 +17,8 @@ export default {
let osterfeuer = this.get_jahre("osterfeuer"); let osterfeuer = this.get_jahre("osterfeuer");
let doppelkopf = this.get_jahre("doppelkopf"); let doppelkopf = this.get_jahre("doppelkopf");
let fussball = this.get_jahre("fussball"); let fussball = this.get_jahre("fussball");
let result = [ if(erntefeste==undefined) return [];
let result = [
{ {
src: erntefeste.map((erntefest) => src: erntefeste.map((erntefest) =>
RitzenbergenLib.RitzenbergenLib.api( RitzenbergenLib.RitzenbergenLib.api(
@@ -98,7 +99,7 @@ export default {
if(this.$route.params.ev){ if(this.$route.params.ev){
let ev = this.$route.params.ev; let ev = this.$route.params.ev;
this.$refs[ev][0].scrollIntoView(); if(this.$refs[ev]) this.$refs[ev][0].scrollIntoView();
this.$router.push("/galerie"); this.$router.push("/galerie");
} }
} }
@@ -156,6 +157,8 @@ export default {
</div> </div>
<br /><br /><br /> <br /><br /><br />
</section> </section>
<h1 v-if="events.length==0">Keine Internetverbindung!</h1>
<br /><br /><br />
<MyFooter /> <MyFooter />
</template> </template>
<style scoped></style> <style scoped></style>

View File

@@ -1,4 +1,4 @@
<script lang="js"> <script lang="ts" setup>
import Navbar from "../components/Navbar.vue"; import Navbar from "../components/Navbar.vue";
import Modal from "../components/Modal.vue"; import Modal from "../components/Modal.vue";
import Embla from "../components/Embla.vue"; import Embla from "../components/Embla.vue";
@@ -10,35 +10,38 @@ import Bilderbuch from "../components/startseite/Bilderbuch.vue";
import Forms from "../components/startseite/Forms.vue"; import Forms from "../components/startseite/Forms.vue";
import Events from "../components/startseite/Events.vue"; import Events from "../components/startseite/Events.vue";
import Willkommen from "../components/startseite/Willkommen.vue"; import Willkommen from "../components/startseite/Willkommen.vue";
import { ref } from "vue";
export default {
components: {
Navbar,
Embla,
Umgebung,
MyFooter, // Geändert von Footer auf MyFooter
WillkommenText,
Bilderbuch,
Forms,
Events,
Willkommen
},
data() { const images=ref([]);
return { async function loadImage(path: string) {
RitzenbergenLib: RitzenbergenLib.RitzenbergenLib, try{
}; const response = await fetch(RitzenbergenLib.RitzenbergenLib.api(path), {
}, headers: {
mounted(){ "Accept":"image/png"
if(this.$route.path !== "/" && this.$route.path!=="/anmeldeformular"){ }
const hash = this.$route.path.replace("/",""); });
console.log(this.$refs[hash]) if(!response.ok) return false;
if(this.$refs[hash].$el) this.$refs[hash].$el.scrollIntoView(); const blob = await response.blob();
this.$router.push("/"); return URL.createObjectURL(blob);
} }catch(e){
} console.warn(e);
}
}
loadImage("randomimage.php?path=/doppelkopf&recursive=1&tn=1&color=white&text=Doppelkopf&size=3").then((url)=>{
images.value[0]=url;
});
loadImage("randomimage.php?path=/erntefest&recursive=1&tn=1&color=white&text=Erntefest&size=3").then((url)=>{
images.value[1]=url;
});
loadImage("randomimage.php?path=/fussball&recursive=1&tn=1&color=white&text=Fußballturnier&size=3").then((url)=>{
images.value[2]=url;
});
loadImage("randomimage.php?path=/osterfeuer&recursive=1&tn=1&color=white&text=Osterfeuer&size=3").then((url)=>{
images.value[3]=url;
});
};
</script> </script>
<template> <template>
@@ -56,18 +59,12 @@ export default {
<section class="slider4 mbr-embla cid-u6k7q0yLdW" id="gallery-13-u6k7q0yLdW"> <section class="slider4 mbr-embla cid-u6k7q0yLdW" id="gallery-13-u6k7q0yLdW" v-if="images[0]">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<Embla :src="[ <Embla :src="images"
RitzenbergenLib.api('randomimage.php?path=/erntefest&recursive=1&tn=1&color=white&text=Erntefest&size=5'),
RitzenbergenLib.api('randomimage.php?path=/osterfeuer&recursive=1&tn=1&color=white&text=Osterfeuer&size=5'),
RitzenbergenLib.api('randomimage.php?path=/doppelkopf&recursive=1&tn=1&color=white&text=Doppelkopf&size=5'),
RitzenbergenLib.api('randomimage.php?path=/fussball&recursive=1&tn=1&color=white&text=Fußballturnier&size=5'),
'http://ritzenbergen.de/Fotos/hauptfoto.jpg'
]"
:links='[ :links='[
"/galerie/erntefest", "/galerie/erntefest",

View File

@@ -4,8 +4,14 @@
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import RitzenbergenLib from "../../ritzenbergenlib.ts"; import RitzenbergenLib from "../../ritzenbergenlib.ts";
const router = useRouter() const router = useRouter()
RitzenbergenLib.RitzenbergenLib.checkInternetConnection().then((result)=>{
if(!result) router.push("/");
});
async function login(){ async function login(){
const url=new URL(RitzenbergenLib.RitzenbergenLib.api("/admin/login.php")); const url=new URL(RitzenbergenLib.RitzenbergenLib.api("/admin/login.php"));
url.searchParams.append("username",username.value); url.searchParams.append("username",username.value);