11<script setup>
2- import { ref } from ' vue'
3-
2+ import { ref ,onMounted } from ' vue'
3+ const {ipcRenderer } = window .electron
4+ const isInstalling = ref (false )
45const plugins = ref ([
56 {
6- id: ' pandoc ' ,
7- name: ' Pandoc Document Converter ' ,
8- publisher: ' OpenConvert ' ,
9- summary: ' Universal document converter supporting Markdown, HTML, LaTeX , DOCX, PDF and many more formats' ,
10- github: ' https://github.com/jgm/pandoc ' ,
11- version: ' 3.1.11 ' ,
12- fileSize: ' 23.4 MB' ,
7+ id: ' mutool ' ,
8+ name: ' MuPDF ' ,
9+ publisher: ' utmp ' ,
10+ summary: ' Universal document converter supporting HTML, EPUB, MOBI , DOCX, PDF and many more formats' ,
11+ github: ' https://github.com/ArtifexSoftware/mupdf ' ,
12+ version: ' 1.25.2 ' ,
13+ fileSize: ' 39.9 MB' ,
1314 installed: false ,
14- formats: {
15- input: [' markdown' , ' html' , ' latex' , ' docx' , ' odt' , ' epub' ],
16- output: [' pdf' , ' docx' , ' html' , ' markdown' , ' epub' , ' latex' ]
17- }
1815 }
1916])
20-
17+ onMounted (async () => {
18+ for (const plugin of plugins .value ) {
19+ const isInstalled = await ipcRenderer .invoke (' plugin:check-installed' , plugin .id )
20+ plugin .installed = isInstalled
21+ }
22+ })
2123async function installPlugin (pluginId ) {
2224 const plugin = plugins .value .find (p => p .id === pluginId)
2325 if (! plugin) return
24-
26+ isInstalling . value = true
2527 try {
26- // Here we would normally call the electron API to install the plugin
27- // For now just simulate installation
28+ await ipcRenderer .invoke (' plugin:install' ,{
29+ url: ' https://github.com/OpenConvert/website/releases/download/0.0.0/mutool.exe' ,
30+ id: pluginId
31+ })
2832 plugin .installed = true
33+ isInstalling .value = false
2934 } catch (error) {
3035 console .error (' Failed to install plugin:' , error)
3136 }
@@ -36,7 +41,7 @@ async function uninstallPlugin(pluginId) {
3641 if (! plugin) return
3742
3843 try {
39- // Here we would normally call the electron API to uninstall the plugin
44+ await ipcRenderer . invoke ( ' plugin:uninstall ' ,pluginId)
4045 plugin .installed = false
4146 } catch (error) {
4247 console .error (' Failed to uninstall plugin:' , error)
@@ -56,7 +61,7 @@ async function uninstallPlugin(pluginId) {
5661 <!-- Plugin Icon (maybe in future releases)-->
5762 <div class =" flex-shrink-0" >
5863 <div class =" bg-gray-600 h-32 w-32 rounded flex items-center justify-center" >
59- <img src =" https://pandoc.org/pandoc-cartoon.svgz " >
64+ <img src =" https://mupdf.readthedocs.io/en/latest/_static/mupdf-sidebar-logo-light.png " >
6065
6166 </div >
6267 </div >
@@ -96,7 +101,9 @@ async function uninstallPlugin(pluginId) {
96101 @click =" plugin.installed ? uninstallPlugin(plugin.id) : installPlugin(plugin.id)"
97102 class =" btn btn-sm"
98103 :class =" plugin.installed ? 'btn-error' : 'btn-primary'"
99- >
104+ > <span v-if =" isInstalling" class =" loading loading-spinner" >
105+ {{ isInstalling ? 'Installing' : 'Install' }}
106+ </span >
100107 {{ plugin.installed ? 'Uninstall' : 'Install' }}
101108 </button >
102109 </div >
0 commit comments