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. <style scoped>
  118. .reportHeader {
  119. display: flex;
  120. margin-top: 1em;
  121. }
  122. </style>
  123. <script>
  124. export default {
  125. data() {
  126. return {
  127. stepTime: 2500,
  128. supportedBrowsers: ["Firefox", "Chrome", "Brave", "Edge", "Opera"],
  129. progress: 1,
  130. steps: {
  131. one: false,
  132. two: false,
  133. three: false,
  134. four: false,
  135. five: false,
  136. },
  137. userInformation: {
  138. browser: {
  139. name: this.$ua._parsed.name,
  140. vendor: this.$ua._parsed.vendor,
  141. version: this.$ua._parsed.version,
  142. },
  143. system: {
  144. os: this.$ua._parsed.os,
  145. version: this.$ua._parsed.os_version,
  146. type: this.$ua._parsed.category,
  147. },
  148. extension: {
  149. serverConnection: null,
  150. latestExtensionVersion: null,
  151. },
  152. },
  153. notices: {
  154. system: {
  155. text: null,
  156. type: null,
  157. },
  158. browser: {
  159. text: null,
  160. type: null,
  161. },
  162. extension: {
  163. text: null,
  164. type: null,
  165. },
  166. },
  167. };
  168. },
  169. mounted() {
  170. //--- Init Stuff ---//
  171. setTimeout(() => {
  172. this.$axios
  173. .$get(
  174. "https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json"
  175. )
  176. .then((res) => {
  177. this.userInformation.extension.latestExtensionVersion = res.version;
  178. });
  179. this.progress++;
  180. this.steps.one = true;
  181. }, this.stepTime);
  182. //--- Check If Extension Is Running ---//
  183. setTimeout(() => {
  184. this.progress++;
  185. this.steps.two = true;
  186. }, this.stepTime * 2);
  187. //--- Check Server Connection ---//
  188. setTimeout(() => {
  189. this.$axios
  190. .$get("https://returnyoutubedislikeapi.com/votes?videoId=QOFEgexls14")
  191. .then(() => {
  192. this.userInformation.extension.serverConnection = true;
  193. })
  194. .catch(() => {
  195. this.userInformation.extension.serverConnection = false;
  196. });
  197. this.progress++;
  198. this.steps.three = true;
  199. }, this.stepTime * 3);
  200. setTimeout(() => {
  201. this.progress++;
  202. this.steps.four = true;
  203. //this.steps.five = true;
  204. //--- Parse Extension Data ---//
  205. 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.`;
  206. this.notices.extension.type = "warning";
  207. if (this.userInformation.extension.serverConnection != true) {
  208. this.notices.extension.text = `Failed to connect to the server!`;
  209. this.notices.extension.type = "error";
  210. }
  211. //--- Parse System Compatibility ---//
  212. this.notices.system.text = `${this.userInformation.system.os} is supported!`;
  213. this.notices.system.type = "success";
  214. if (this.userInformation.system.type != "pc") {
  215. this.notices.system.text = `"${this.userInformation.system.type}" may not be a supported device type!`;
  216. this.notices.system.type = "warning";
  217. }
  218. //--- Parse Browser Compatibility ---//
  219. this.notices.browser.text = `${this.userInformation.browser.name} ${this.userInformation.browser.version} is supported!`;
  220. this.notices.browser.type = "success";
  221. if (!this.supportedBrowsers.includes(this.userInformation.browser.name)) {
  222. 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.`;
  223. this.notices.browser.type = "warning";
  224. }
  225. }, this.stepTime * 4);
  226. },
  227. };
  228. </script>