You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

waifu.vue 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="wizard-project">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="sync-alt" /></span>
  6. <span>Updater</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. {{ $waifu.name }}. Optional algorithm to upscale photos.
  10. </h3>
  11. <template v-slot:right>
  12. <button class="button" @click="$dreamtime.openAppDataFolder()">
  13. <span class="icon"><font-awesome-icon icon="folder-open" /></span>
  14. <span>{{ $dreamtime.name }} Folder</span>
  15. </button>
  16. </template>
  17. </PageHeader>
  18. <div class="project__content">
  19. <div v-if="requirements.waifu.error" class="notification notification--danger">
  20. <h5>CHECK ERROR!</h5>
  21. Failed to get the installed {{ $dreampower.name }} version. Please fix this problem before continuing.<br>
  22. You can visit our <a href="https://chat.dreamnet.tech" target="_blank">chat</a> to get support.
  23. <br><br>
  24. <pre>{{ requirements.waifu.error.stack }}</pre>
  25. </div>
  26. <div v-else-if="requirements.waifu.installed && !requirements.waifu.compatible" class="notification notification--danger">
  27. <h5>OUTDATED</h5>
  28. This component requires an update to continue.
  29. </div>
  30. <div v-if="$waifu.version" class="notification">
  31. Installed version: <strong>{{ $waifu.version }}</strong>
  32. </div>
  33. <div v-if="isMacOS" class="notification">
  34. <h5>Waifu2X on Mac OS is experimental!</h5>
  35. You may need to run the command <code>brew install openblas</code> before using it.
  36. </div>
  37. <div v-if="$settings.preferences.advanced.device === 'GPU'" class="notification">
  38. <h5>Waifu2X require CUDA 10.2</h5>
  39. Before using Waifu2X on GPU please <a href="https://developer.nvidia.com/cuda-10.2-download-archive" target="_blank">download and install CUDA 10.2</a>
  40. </div>
  41. <div v-if="updater.error" class="notification notification--danger">
  42. <h5>CONNECTION ERROR!</h5>
  43. <span>A problem has occurred when trying to get the information from Github, please make sure you have a stable internet connection and restart the application.</span>
  44. <br><br>
  45. <pre>
  46. <span v-if="updater.errorResponse">{{ updater.errorResponse }}</span>
  47. {{ updater.error.stack }}
  48. </pre>
  49. </div>
  50. <AppBox>
  51. <ProjectUpdate project="waifu" />
  52. </AppBox>
  53. <AppBox title="Settings.">
  54. <!-- Download protocol. -->
  55. <MenuItem
  56. label="Download protocol.">
  57. <template v-slot:description>
  58. <span class="item__description">Select the protocol that will be used to download the file. <AppTip tooltip="- <strong>Any</strong>: Use all protocols if necessary.<br>- <strong>HTTP</strong>: Download the file from verified servers. Fastest and most reliable for most connections.<br>- <strong>Torrent & IPFS</strong>: Download the file from other computers. It is possible to cancel the download and resume it later. More reliable for low speed connections. May require a few minutes of preparation before starting the download." /></span>
  59. </template>
  60. <select v-model="updater.downloadMethod" class="input">
  61. <option :value="0">
  62. Any
  63. </option>
  64. <option :value="1">
  65. HTTP
  66. </option>
  67. <option v-if="updater.hasTorrentUrls" :value="3">
  68. Torrent
  69. </option>
  70. <option v-if="updater.hasIPFSUrls" :value="2">
  71. IPFS
  72. </option>
  73. </select>
  74. </MenuItem>
  75. <SettingsField v-if="!$dreamtime.isPortable" label="Location" field-id="folders.waifu">
  76. <input
  77. v-model="$settings.folders.waifu"
  78. readonly
  79. class="input"
  80. title="Change"
  81. @click="changeWaifu">
  82. </SettingsField>
  83. </AppBox>
  84. </div>
  85. <div class="wizard__footer">
  86. <button v-if="!requirements.waifu.installed"
  87. v-tooltip="'This component is optional.'"
  88. class="button button--xl"
  89. @click="skip">
  90. Skip
  91. </button>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import { isNil } from 'lodash'
  97. import { requirements } from '~/modules/system'
  98. import { waifu } from '~/modules/projects'
  99. const { dialog } = $provider.api
  100. const { existsSync } = $provider.fs
  101. export default {
  102. layout: 'wizard',
  103. middleware({ redirect, route }) {
  104. if (!route.query.forced) {
  105. if (requirements.waifu.installed && requirements.waifu.compatible && !waifu.updater.available) {
  106. redirect('/wizard/telemetry')
  107. }
  108. }
  109. },
  110. data: () => ({
  111. requirements,
  112. }),
  113. computed: {
  114. isMacOS() {
  115. return process.platform === 'darwin'
  116. },
  117. updater() {
  118. return waifu.updater
  119. },
  120. },
  121. methods: {
  122. showOpenDialog(path) {
  123. const dir = dialog.showOpenDialogSync({
  124. defaultPath: path,
  125. properties: ['openDirectory'],
  126. })
  127. if (isNil(dir)) {
  128. return path
  129. }
  130. if (!existsSync(dir[0])) {
  131. // ???
  132. return path
  133. }
  134. return dir[0]
  135. },
  136. changeWaifu() {
  137. const dir = this.showOpenDialog(this.$settings.folders.waifu)
  138. this.$settings.folders.waifu = dir
  139. },
  140. skip() {
  141. this.$settings.wizard.waifu = true
  142. this.$router.push('/wizard/telemetry')
  143. },
  144. },
  145. }
  146. </script>