From 4f257b74646c4c7478bfae0d8d8e7eb153bb0fd2 Mon Sep 17 00:00:00 2001 From: kaangiray26 Date: Wed, 28 Jun 2023 16:26:01 +0200 Subject: [PATCH] deploy via script --- src/pages/Post.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/Post.vue b/src/pages/Post.vue index ef928fe..9685114 100644 --- a/src/pages/Post.vue +++ b/src/pages/Post.vue @@ -10,15 +10,24 @@ import { ref, onBeforeMount, onActivated } from 'vue'; import { useRouter } from 'vue-router'; import { CapacitorHttp } from '@capacitor/core'; -import { extractors } from "https://kaangiray26.github.io/endless/src/js/extractors.min.js"; import Post from '/components/SinglePost.vue'; const router = useRouter(); +const extractors = ref([]); + const ex = ref(null); const item = ref(null); async function setup() { + // Get the extractor script + let js = await fetch(extractors.value[router.currentRoute.value.params.domain].url) + .then(res => res.text()) + .then(res => res + "return extractor();") + .catch(err => null); + ex.value = new Function(js)(); + + // Get post let response = await ex.value.get_post(router.currentRoute.value.params.id.join("/"), CapacitorHttp); if (!response) { return; @@ -29,7 +38,7 @@ async function setup() { onBeforeMount(() => { // Set the extractor - ex.value = extractors[router.currentRoute.value.params.domain]; + extractors.value = JSON.parse(localStorage.getItem('list')); // Run setup setup();