Implementing exercise 3.2
This commit is contained in:
25
backend/images/scripts/test.js
Normal file
25
backend/images/scripts/test.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
let username = document.getElementById("txt-username")
|
||||||
|
let password = document.getElementById("txt-password")
|
||||||
|
let loginBtn = document.getElementById("btn-login")
|
||||||
|
|
||||||
|
console.log("Active")
|
||||||
|
|
||||||
|
function grabData() {
|
||||||
|
console.log("Grabbed Username: " + username?.value + ", grabbed password: " + password?.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
username?.addEventListener("keypress", (event) => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
grabData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
password?.addEventListener("keypress", (event) => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
grabData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
loginBtn?.addEventListener("click", (event) => {
|
||||||
|
grabData()
|
||||||
|
})
|
||||||
@@ -30,10 +30,14 @@ files.get("/:folder", async (req: Request, res: Response) => {
|
|||||||
let result = []
|
let result = []
|
||||||
let fileNames = fs.readdirSync("./backend/images/" + req.params.folder + "/")
|
let fileNames = fs.readdirSync("./backend/images/" + req.params.folder + "/")
|
||||||
|
|
||||||
|
|
||||||
fileNames.forEach(file => {
|
fileNames.forEach(file => {
|
||||||
|
let resData = fs.readFileSync("./backend/images/" + req.params.folder + "/" + file, "utf8")
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
name: file,
|
name: file,
|
||||||
size: fs.statSync("./backend/images/" + req.params.folder + "/" + file).size,
|
size: fs.statSync("./backend/images/" + req.params.folder + "/" + file).size,
|
||||||
|
content: resData,
|
||||||
url: "http://localhost:3000/static/" + req.params.folder + "/" + file
|
url: "http://localhost:3000/static/" + req.params.folder + "/" + file
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,9 +52,13 @@ watch(() => route.path, () => {
|
|||||||
|
|
||||||
<!-- Logic to check, if exercise 3.1 is solved -->
|
<!-- Logic to check, if exercise 3.1 is solved -->
|
||||||
<div v-for="query in route.query">
|
<div v-for="query in route.query">
|
||||||
<span v-if="String(query).startsWith('<iframe')">
|
<span v-if="String(query).startsWith('<img src=1 onerror=alert(')">
|
||||||
{{ exerciseStore.solveExercise(3, 1) }}
|
{{ exerciseStore.solveExercise(3, 1) }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span v-if="String(query).startsWith('<img src=1 onerror=import(')">
|
||||||
|
{{ exerciseStore.solveExercise(3, 2) }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ function navigate() {
|
|||||||
router.push(newPath)
|
router.push(newPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshPage() {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => router.currentRoute.value.fullPath, () => {
|
watch(() => router.currentRoute.value.fullPath, () => {
|
||||||
path.value = "https://www.eventmaster.com" + router.currentRoute.value.fullPath
|
path.value = "https://www.eventmaster.com" + router.currentRoute.value.fullPath
|
||||||
})
|
})
|
||||||
@@ -61,7 +65,7 @@ watch(() => router.currentRoute.value.fullPath, () => {
|
|||||||
<v-btn
|
<v-btn
|
||||||
density="comfortable"
|
density="comfortable"
|
||||||
icon="mdi-refresh"
|
icon="mdi-refresh"
|
||||||
@click="router.replace({ path: router.currentRoute.value.fullPath })"
|
@click="refreshPage()"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import cardView from '@/components/basics/cardView.vue';
|
import cardView from '@/components/basics/cardView.vue';
|
||||||
import outlinedButton from '@/components/basics/outlinedButton.vue';
|
import outlinedButton from '@/components/basics/outlinedButton.vue';
|
||||||
import { useAccountStore } from '@/stores/account.store';
|
import { useAccountStore } from '@/stores/account.store';
|
||||||
|
import { watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
const accountStore = useAccountStore()
|
const accountStore = useAccountStore()
|
||||||
@@ -33,6 +34,7 @@ async function startLogin() {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="startLogin"
|
@keyup.enter="startLogin"
|
||||||
|
id="txt-username"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -47,6 +49,7 @@ async function startLogin() {
|
|||||||
v-model="accountStore.loginData.password"
|
v-model="accountStore.loginData.password"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="startLogin"
|
@keyup.enter="startLogin"
|
||||||
|
id="txt-password"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -65,6 +68,7 @@ async function startLogin() {
|
|||||||
@click="startLogin"
|
@click="startLogin"
|
||||||
:loading="accountStore.fetchInProgress"
|
:loading="accountStore.fetchInProgress"
|
||||||
color="green"
|
color="green"
|
||||||
|
id="btn-login"
|
||||||
>
|
>
|
||||||
{{ $t('account.login.login') }}
|
{{ $t('account.login.login') }}
|
||||||
</outlined-button>
|
</outlined-button>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ filesStore.getStaticFolders()
|
|||||||
:add-button-string="$t('misc.uploadFile')"
|
:add-button-string="$t('misc.uploadFile')"
|
||||||
:fetch-in-progress="filesStore.fetchInProgress"
|
:fetch-in-progress="filesStore.fetchInProgress"
|
||||||
:on-add-click="() => { filesStore.showFileUploadDialog = true }"
|
:on-add-click="() => { filesStore.showFileUploadDialog = true }"
|
||||||
|
:hide-add-button="true"
|
||||||
>
|
>
|
||||||
<v-row >
|
<v-row >
|
||||||
<v-col cols="2" class="border">
|
<v-col cols="2" class="border">
|
||||||
@@ -48,9 +49,28 @@ filesStore.getStaticFolders()
|
|||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col class="border">
|
<v-col class="border">
|
||||||
<v-img
|
<v-row>
|
||||||
v-if="filesStore.selectedFile != undefined"
|
<v-col>
|
||||||
:src="filesStore.selectedFile.url" max-height="400" />
|
{{ filesStore.selectedFile.url }}
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<v-col>
|
||||||
|
<v-textarea
|
||||||
|
v-if="filesStore.selectedFile != undefined && filesStore.selectedFile.name.endsWith('html')"
|
||||||
|
:model-value="filesStore.selectedFile.content"
|
||||||
|
variant="outlined"
|
||||||
|
label="Content"
|
||||||
|
height="300"
|
||||||
|
rows="30"
|
||||||
|
/>
|
||||||
|
<v-img
|
||||||
|
v-else-if="filesStore.selectedFile != undefined"
|
||||||
|
:src="filesStore.selectedFile.url" max-height="400"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</admin-data-layout>
|
</admin-data-layout>
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ export const useFilesStore = defineStore('filesStore', {
|
|||||||
selectedFolder: ref<{name: string, nrOfItems: number}>(),
|
selectedFolder: ref<{name: string, nrOfItems: number}>(),
|
||||||
|
|
||||||
/** List of files on the server */
|
/** List of files on the server */
|
||||||
staticFiles: ref<Array<{name: string, size: number, url: string}>>([]),
|
staticFiles: ref<Array<{name: string, size: number, content: string, url: string}>>([]),
|
||||||
|
|
||||||
selectedFile: ref<{name: string, size: number, url: string}>(),
|
selectedFile: ref<{name: string, size: number, content: string, url: string}>(),
|
||||||
|
|
||||||
showFileUploadDialog: ref(false),
|
showFileUploadDialog: ref(false),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user