archive retrieval now works

This commit is contained in:
2025-10-31 13:27:57 +00:00
parent f039ba219d
commit fdf3c1319d
6 changed files with 532 additions and 617 deletions

1087
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import useArchiveStore from "@/stores/archive";
import { versionNotes } from "@/utils/types";
import {
IonButton,
IonCard,
@@ -13,8 +14,11 @@ IonLabel, IonItem,
IonList
} from "@ionic/vue";
import {chevronForward} from "ionicons/icons";
import { ref, watch } from "vue";
const archive = useArchiveStore();
const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>();
const versions = ref<versionNotes[]>([]);
const back = () => {
emit("back");
@@ -24,10 +28,13 @@ const disconnect = () => {
emit("disconnect");
};
const details = () => {
const details = (index: number) => {
archive.setShownI(index);
emit("details");
}
watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immediate: true});
</script>
<template>
@@ -47,10 +54,10 @@ const details = () => {
<ion-card-content>
<ion-button @click="back">Back</ion-button>
<ion-list lines="full" class="item-scroll">
<ion-item :button="true" v-for="i in 10" :key="i" @click="details">
<ion-item :button="true" v-for="(version, index) in versions" :key="index" @click="details(index)">
<ion-label>
<strong>v{{i}}</strong> <br>
<ion-note>date</ion-note>
<strong>{{version.title}}</strong> <br>
<ion-note>{{ version.date }}</ion-note>
</ion-label>
<div slot="end" class="metadata-end-wrapper">
<ion-icon color="medium" :icon="chevronForward"></ion-icon>

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import useArchiveStore from "@/stores/archive";
import {
IonButton,
IonCard,
@@ -7,8 +8,12 @@ import {
IonCardSubtitle,
IonCardTitle,
} from "@ionic/vue";
import { versionNotes } from "@/utils/types";
import { ref } from "vue";
const archive = useArchiveStore();
const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>();
const record = ref<versionNotes>(archive.getArchive[archive.getShownI]);
const back = () => {
emit("back");
@@ -22,6 +27,7 @@ const choose = () => {
emit("choose");
};
console.log(archive.getArchive)
</script>
<template>
@@ -40,10 +46,11 @@ const choose = () => {
<ion-card-content>
<ion-card>
<ion-card-header>
<ion-card-title>Update Name</ion-card-title>
<ion-card-title :href="record.link">{{ record.title }}</ion-card-title>
</ion-card-header>
<ion-card-content>
<p>Some blurb about the update</p>
<p>{{ record.date as Date }}</p>
<p v-html="record.html"></p> <br/>
<ion-button @click="choose">Select</ion-button>
<ion-button @click="back">Cancel</ion-button>
</ion-card-content>

View File

@@ -6,7 +6,7 @@ import {ref} from "vue";
const emit = defineEmits<{(e: "disconnect"): void, (e: "back"): void}>();
const archive = useArchiveStore();
const url = ref<string>("");
const url = ref<string>(archive.getUrl);
const disconnect = () => {
emit("disconnect")
@@ -19,7 +19,6 @@ const back = () => {
const setSource = () => {
console.log(url.value)
archive.setUrl(url.value);
archive.testArchive();
}
</script>

View File

@@ -1,22 +1,33 @@
import { defineStore } from "pinia";
import Updater from "updaterweblibrary";
import type { versionNotes } from "@/utils/types";
const useArchiveStore = defineStore("archive", {
state: () => (
{updater: new Updater()}
{updater: new Updater(), archive: <versionNotes[]>[], shownI: 0}
),
getters: {
getUrl(): string {
return this.updater.archiveURL;
if (this.updater.archiveURL == "/")
return ""
else
return this.updater.archiveURL;
},
getArchive(): versionNotes[] {
console.log(this.archive)
return this.archive;
},
getShownI(): number {
return this.shownI;
}
},
actions: {
setUrl(value: string): void {
this.updater = new Updater(value, "rss");
async setUrl(value: string): Promise<void> {
this.updater = new Updater(value, "atom");
this.archive = await this.updater.getArchive()
},
async testArchive(): Promise<void> {
console.log(await this.updater.getArchive());
setShownI(value: number): void {
this.shownI = value;
}
}
});

6
src/utils/types.ts Normal file
View File

@@ -0,0 +1,6 @@
export type versionNotes = {
title: string;
date: Date | string;
link: string;
html: string;
}