debug.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div>
  3. <v-stepper :value="progress" class="mt-12" outlined max-width="800px">
  4. <v-stepper-header>
  5. <v-stepper-step step="1" :complete="steps.one">Setup</v-stepper-step>
  6. <v-divider />
  7. <v-stepper-step step="2" :complete="steps.two"
  8. >Extension Status</v-stepper-step
  9. >
  10. <v-divider />
  11. <v-stepper-step step="3" :complete="steps.three"
  12. >Server Connection</v-stepper-step
  13. >
  14. <v-divider />
  15. <v-stepper-step step="4" :complete="steps.four"
  16. >Browser Support</v-stepper-step
  17. >
  18. <v-divider />
  19. <v-stepper-step step="5" :complete="steps.five">Report</v-stepper-step>
  20. </v-stepper-header>
  21. <v-stepper-content step="1">
  22. <h1>Getting Ready...</h1>
  23. <v-progress-circular
  24. indeterminate
  25. size="50"
  26. width="5"
  27. color="primary"
  28. />
  29. </v-stepper-content>
  30. <v-stepper-content step="2">
  31. <h1>Ensuring the Extension is Running...</h1>
  32. <v-progress-circular
  33. indeterminate
  34. size="50"
  35. width="5"
  36. color="primary"
  37. />
  38. </v-stepper-content>
  39. <v-stepper-content step="3">
  40. <h1>Testing Server Connection...</h1>
  41. <v-progress-circular
  42. indeterminate
  43. size="50"
  44. width="5"
  45. color="primary"
  46. />
  47. </v-stepper-content>
  48. <v-stepper-content step="4">
  49. <h1>Checking Browser Information...</h1>
  50. <v-progress-circular
  51. indeterminate
  52. size="50"
  53. width="5"
  54. color="primary"
  55. />
  56. </v-stepper-content>
  57. <v-stepper-content step="5" style="text-align: left">
  58. <div class="reportHeader">
  59. <h1>Browser</h1>
  60. <v-divider style="transform: translateY(1.5em)" />
  61. </div>
  62. <v-alert
  63. dense
  64. outlined
  65. :type="notices.browser.type"
  66. v-text="notices.browser.text"
  67. />
  68. <span><b>BROWSER-</b> {{ userInformation.browser.name }}</span
  69. ><br />
  70. <span><b>VENDOR-</b> {{ userInformation.browser.vendor }} </span><br />
  71. <span><b>VERSION-</b> {{ userInformation.browser.version }}</span
  72. ><br />
  73. <div class="reportHeader">
  74. <h1>System</h1>
  75. <v-divider style="transform: translateY(1.5em)" />
  76. </div>
  77. <v-alert
  78. dense
  79. outlined
  80. :type="notices.system.type"
  81. v-text="notices.system.text"
  82. />
  83. <span><b>OS-</b> {{ userInformation.system.os }}</span
  84. ><br />
  85. <span><b>VERSION-</b> {{ userInformation.system.version }} </span><br />
  86. <span><b>TYPE-</b> {{ userInformation.system.type }}</span
  87. ><br />
  88. <div class="reportHeader">
  89. <h1>Extension</h1>
  90. <v-divider style="transform: translateY(1.5em)" />
  91. </div>
  92. <v-alert
  93. dense
  94. outlined
  95. :type="notices.extension.type"
  96. v-text="notices.extension.text"
  97. />
  98. <span
  99. ><b>LATEST EXTENSION VERSION-</b>
  100. {{
  101. userInformation.extension.latestExtensionVersion ||
  102. "Failed to lookup data"
  103. }}</span
  104. ><br />
  105. <span
  106. ><b>SERVER CONNECTION-</b>
  107. {{
  108. userInformation.extension.serverConnection
  109. ? "Working"
  110. : "Failed to connect"
  111. }}</span
  112. ><br />
  113. </v-stepper-content>
  114. </v-stepper>
  115. </div>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. stepTime: 2500,
  122. supportedBrowsers: ["Firefox", "Chrome", "Brave", "Edge", "Opera"],
  123. progress: 1,
  124. steps: {
  125. one: false,
  126. two: false,
  127. three: false,
  128. four: false,
  129. five: false,
  130. },
  131. userInformation: {
  132. browser: {
  133. name: this.$ua._parsed.name,
  134. vendor: this.$ua._parsed.vendor,
  135. version: this.$ua._parsed.version,
  136. },
  137. system: {
  138. os: this.$ua._parsed.os,
  139. version: this.$ua._parsed.os_version,
  140. type: this.$ua._parsed.category,
  141. },
  142. extension: {
  143. serverConnection: null,
  144. latestExtensionVersion: null,
  145. },
  146. },
  147. notices: {
  148. system: {
  149. text: null,
  150. type: null,
  151. },
  152. browser: {
  153. text: null,
  154. type: null,
  155. },
  156. extension: {
  157. text: null,
  158. type: null,
  159. },
  160. },
  161. };
  162. },
  163. mounted() {
  164. //--- Init Stuff ---//
  165. setTimeout(() => {
  166. this.$axios
  167. .$get(
  168. "https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json"
  169. )
  170. .then((res) => {
  171. this.userInformation.extension.latestExtensionVersion = res.version;
  172. });
  173. this.progress++;
  174. this.steps.one = true;
  175. }, this.stepTime);
  176. //--- Check If Extension Is Running ---//
  177. setTimeout(() => {
  178. this.progress++;
  179. this.steps.two = true;
  180. }, this.stepTime * 2);
  181. //--- Check Server Connection ---//
  182. setTimeout(() => {
  183. this.$axios
  184. .$get("https://returnyoutubedislikeapi.com/votes?videoId=QOFEgexls14")
  185. .then(() => {
  186. this.userInformation.extension.serverConnection = true;
  187. })
  188. .catch(() => {
  189. this.userInformation.extension.serverConnection = false;
  190. });
  191. this.progress++;
  192. this.steps.three = true;
  193. }, this.stepTime * 3);
  194. setTimeout(() => {
  195. this.progress++;
  196. this.steps.four = true;
  197. //this.steps.five = true;
  198. //--- Parse Extension Data ---//
  199. this.notices.extension.text = `We are unable to automatically check that your extension is up to date. Please check that the number below matches your extension version.`;
  200. this.notices.extension.type = "warning";
  201. if (this.userInformation.extension.serverConnection != true) {
  202. this.notices.extension.text = `Failed to connect to the server!`;
  203. this.notices.extension.type = "error";
  204. }
  205. //--- Parse System Compatibility ---//
  206. this.notices.system.text = `${this.userInformation.system.os} is supported!`;
  207. this.notices.system.type = "success";
  208. if (this.userInformation.system.type != "pc") {
  209. this.notices.system.text = `"${this.userInformation.system.type}" may not be a supported device type!`;
  210. this.notices.system.type = "warning";
  211. }
  212. //--- Parse Browser Compatibility ---//
  213. this.notices.browser.text = `${this.userInformation.browser.name} ${this.userInformation.browser.version} is supported!`;
  214. this.notices.browser.type = "success";
  215. if (!this.supportedBrowsers.includes(this.userInformation.browser.name)) {
  216. this.notices.browser.text = `${this.userInformation.browser.name} is not a supported browser! You may continue to use the extension, but we don't provide official support.`;
  217. this.notices.browser.type = "warning";
  218. }
  219. }, this.stepTime * 4);
  220. },
  221. };
  222. </script>
  223. <style scoped>
  224. .reportHeader {
  225. display: flex;
  226. margin-top: 1em;
  227. }
  228. </style>