1
0
ソースを参照

prettier style

boyska 7 ヶ月 前
コミット
cfd4366718
5 ファイル変更37 行追加26 行削除
  1. 10 7
      src/js/radiomanifest.js
  2. 8 8
      src/js/store.js
  3. 8 2
      src/pages/Radio.vue
  4. 3 1
      src/pages/RadioLive.vue
  5. 8 8
      src/pages/home.vue

+ 10 - 7
src/js/radiomanifest.js

@@ -1,25 +1,28 @@
 import radiomanifest from "@radiomanifest/radiomanifest";
 
-const knownRadios = ["https://www.ondarossa.info", "https://radiospore.oziosi.org"]
+const knownRadios = [
+  "https://www.ondarossa.info",
+  "https://radiospore.oziosi.org",
+];
 class Controller {
   constructor() {
-    this.cache = {}
-    this.currentRadio = null
+    this.cache = {};
+    this.currentRadio = null;
 
-    for(let r in knownRadios) {
+    for (let r in knownRadios) {
       this.get(r);
     }
   }
 
   async get(url) {
-    if(this.cache[url]) {
+    if (this.cache[url]) {
       this.currentRadio = this.cache[url];
       return this.cache[url];
     }
     this.cache[url] = knownRadios[url];
     // fetch more data in background
-    this.cache[url] = await radiomanifest.get(url)
-    return this.cache[url]
+    this.cache[url] = await radiomanifest.get(url);
+    return this.cache[url];
   }
 }
 

+ 8 - 8
src/js/store.js

@@ -1,16 +1,16 @@
-import { defineStore } from 'pinia'
+import { defineStore } from "pinia";
 
-export const useRadioStore = defineStore('radio', {
+export const useRadioStore = defineStore("radio", {
   state: () => {
     return {
       radios: {
-      "https://www.ondarossa.info": {
-      name: "ROR",
+        "https://www.ondarossa.info": {
+          name: "ROR",
+        },
+        "https://radiospore.oziosi.org": {
+          name: "Spore",
+        },
       },
-      "https://radiospore.oziosi.org": {
-      name: "Spore",
-      },
-      }
     };
   },
   // could also be defined as

+ 8 - 2
src/pages/Radio.vue

@@ -8,8 +8,14 @@
       <f7-preloader v-if="loading" />
     </div>
     <f7-list v-else>
-      <f7-list-item title="Diretta" :link="`/radio/${encodeURIComponent(radioUrl)}/live`" />
-      <f7-list-item title="Trasmissioni" :link="`/radio/${encodeURIComponent(radioUrl)}/shows`" />
+      <f7-list-item
+        title="Diretta"
+        :link="`/radio/${encodeURIComponent(radioUrl)}/live`"
+      />
+      <f7-list-item
+        title="Trasmissioni"
+        :link="`/radio/${encodeURIComponent(radioUrl)}/shows`"
+      />
       <f7-list-item
         title="Contatti"
         :link="`/radio/${encodeURIComponent(radioUrl)}/contacts`"

+ 3 - 1
src/pages/RadioLive.vue

@@ -33,7 +33,9 @@ export default {
   props: { f7route: Object, f7router: Object },
   async mounted() {
     try {
-      this.Radio = await radiomanifest.get(decodeURIComponent(this.f7route.params.radioUrl));
+      this.Radio = await radiomanifest.get(
+        decodeURIComponent(this.f7route.params.radioUrl),
+      );
       const currentShow = this.Radio.getShowAtTime();
       this.currentShowName =
         currentShow == null ? "live" : currentShow.getName();

+ 8 - 8
src/pages/home.vue

@@ -1,14 +1,14 @@
 <script setup>
 import { useRadioStore } from "../js/store";
 import radiomanifest from "@radiomanifest/radiomanifest";
-const store = useRadioStore()
-	setTimeout(() => {
-			for(const url of Object.keys(store.radios)) {
-			radiomanifest.get(url).then((data) => {
-					store.radios[url] = {...store.radios[url], ...data}
-					});
-			}
-			}, 100)
+const store = useRadioStore();
+setTimeout(() => {
+  for (const url of Object.keys(store.radios)) {
+    radiomanifest.get(url).then((data) => {
+      store.radios[url] = { ...store.radios[url], ...data };
+    });
+  }
+}, 100);
 </script>
 <template>
   <f7-page name="home">