debug.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div>
  3. <div id="extension-version" />
  4. <v-stepper :value="progress" class="mt-12" outlined max-width="800px">
  5. <v-stepper-header>
  6. <v-stepper-step step="1" :complete="steps.one">Setup</v-stepper-step>
  7. <v-divider />
  8. <v-stepper-step step="2" :complete="steps.two">Extension Status</v-stepper-step>
  9. <v-divider />
  10. <v-stepper-step step="3" :complete="steps.three">Server Connection</v-stepper-step>
  11. <v-divider />
  12. <v-stepper-step step="4" :complete="steps.four">Browser Support</v-stepper-step>
  13. <v-divider />
  14. <v-stepper-step step="5" :complete="steps.five">Report</v-stepper-step>
  15. </v-stepper-header>
  16. <v-stepper-content step="1">
  17. <h1>Getting Ready...</h1>
  18. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  19. </v-stepper-content>
  20. <v-stepper-content step="2">
  21. <h1>Ensuring the Extension is Running...</h1>
  22. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  23. </v-stepper-content>
  24. <v-stepper-content step="3">
  25. <h1>Testing Server Connection...</h1>
  26. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  27. </v-stepper-content>
  28. <v-stepper-content step="4">
  29. <h1>Checking Browser Information...</h1>
  30. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  31. </v-stepper-content>
  32. <v-stepper-content step="5" style="text-align:left">
  33. <div class="reportHeader">
  34. <h1>Browser</h1>
  35. <v-divider style="transform: translateY(1.5em)" />
  36. </div>
  37. <v-alert dense outlined v-text="notices.browser.text" :type="notices.browser.type" />
  38. <span><b>BROWSER-</b> {{ userInformation.browser.name }}</span><br>
  39. <span><b>VENDOR-</b> {{ userInformation.browser.vendor }} </span><br>
  40. <span><b>VERSION-</b> {{ userInformation.browser.version }}</span><br>
  41. <div class="reportHeader">
  42. <h1>System</h1>
  43. <v-divider style="transform: translateY(1.5em)" />
  44. </div>
  45. <v-alert dense outlined v-text="notices.system.text" :type="notices.system.type" />
  46. <span><b>OS-</b> {{ userInformation.system.os }}</span><br>
  47. <span><b>VERSION-</b> {{ userInformation.system.version }} </span><br>
  48. <span><b>TYPE-</b> {{ userInformation.system.type }}</span><br>
  49. <div class="reportHeader">
  50. <h1>Extension</h1>
  51. <v-divider style="transform: translateY(1.5em)" />
  52. </div>
  53. <v-alert dense outlined v-text="notices.extension.text" :type="notices.extension.type" />
  54. <span><b>RUNNING-</b> {{ userInformation.extension.running ? "Yes" : "Failed to connect"}}</span><br>
  55. <span><b>VERSION-</b> {{ userInformation.extension.version || "Failed to connect"}} </span><br>
  56. <span><b>SERVER CONNECTION-</b>{{ userInformation.extension.serverConnection ? "Working" : "Failed to connect" }}</span><br>
  57. </v-stepper-content>
  58. </v-stepper>
  59. </div>
  60. </template>
  61. <style scoped>
  62. .reportHeader {
  63. display: flex;
  64. margin-top: 1em;
  65. }
  66. </style>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. stepTime: 1000,
  72. supportedBrowsers: ["Firefox", "Chrome", "Brave", "Edge", "Opera"],
  73. progress: 1,
  74. steps: {
  75. one: false,
  76. two: false,
  77. three: false,
  78. four: false,
  79. five: false,
  80. },
  81. userInformation: {
  82. browser: {
  83. name: this.$ua._parsed.name,
  84. vendor: this.$ua._parsed.vendor,
  85. version: this.$ua._parsed.version
  86. },
  87. system: {
  88. os: this.$ua._parsed.os,
  89. version: this.$ua._parsed.os_version,
  90. type: this.$ua._parsed.category
  91. },
  92. extension: {
  93. running: null,
  94. version: null,
  95. serverConnection: null,
  96. latestExtensionVersion: null,
  97. },
  98. },
  99. notices: {
  100. system: {
  101. text: null,
  102. type: null
  103. },
  104. browser: {
  105. text: null,
  106. type: null
  107. },
  108. extension: {
  109. text: null,
  110. type: null
  111. }
  112. }
  113. }
  114. },
  115. mounted() {
  116. //--- Wait ---//
  117. setTimeout(() => {
  118. this.$axios.$get('https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json')
  119. .then(res => {
  120. console.log(res)
  121. })
  122. this.progress++;
  123. this.steps.one = true;
  124. }, this.stepTime);
  125. //--- Check If Extension Is Running ---//
  126. setTimeout(() => {
  127. this.progress++;
  128. this.steps.two = true;
  129. }, this.stepTime * 2);
  130. //--- Check Server Connection ---//
  131. setTimeout(() => {
  132. this.$axios.$get('https://returnyoutubedislikeapi.com/votes?videoId=QOFEgexls14')
  133. .then(res => {
  134. this.userInformation.extension.serverConnection = true;
  135. })
  136. .catch(err => {
  137. this.userInformation.extension.serverConnection = false;
  138. })
  139. this.progress++;
  140. this.steps.three = true;
  141. }, this.stepTime * 3);
  142. setTimeout(() => {
  143. this.progress++;
  144. this.steps.four = true;
  145. //this.steps.five = true;
  146. //--- Parse Extension Data ---//
  147. this.notices.extension.text = `Everything is running normally!`;
  148. this.notices.extension.type = "success";
  149. if (this.userInformation.extension.running != true) {
  150. this.notices.extension.text = `The extension doesn't appear to be running!`;
  151. this.notices.extension.type = "error";
  152. }
  153. if (this.userInformation.extension.serverConnection != true) {
  154. this.notices.extension.text = `Failed to connect to the server!`;
  155. this.notices.extension.type = "error";
  156. }
  157. //--- Parse System Compatibility ---//
  158. this.notices.system.text = `${this.userInformation.system.os} is supported!`;
  159. this.notices.system.type = "success";
  160. if (this.userInformation.system.type != "pc") {
  161. this.notices.system.text = `"${this.userInformation.system.type}" may not be a supported device type!`;
  162. this.notices.system.type = "warning";
  163. }
  164. //--- Parse Browser Compatibility ---//
  165. this.notices.browser.text = `${this.userInformation.browser.name} ${this.userInformation.browser.version} is supported!`;
  166. this.notices.browser.type = "success";
  167. if (!this.supportedBrowsers.includes(this.userInformation.browser.name)) {
  168. 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.`;
  169. this.notices.browser.type = "warning";
  170. }
  171. }, this.stepTime * 4);
  172. }
  173. }
  174. </script>