debug.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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">Extension Status</v-stepper-step>
  8. <v-divider />
  9. <v-stepper-step step="3" :complete="steps.three">Server Connection</v-stepper-step>
  10. <v-divider />
  11. <v-stepper-step step="4" :complete="steps.four">Browser Support</v-stepper-step>
  12. <v-divider />
  13. <v-stepper-step step="5" :complete="steps.five">Report</v-stepper-step>
  14. </v-stepper-header>
  15. <v-stepper-content step="1">
  16. <h1>Getting Ready...</h1>
  17. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  18. </v-stepper-content>
  19. <v-stepper-content step="2">
  20. <h1>Ensuring the Extension is Running...</h1>
  21. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  22. </v-stepper-content>
  23. <v-stepper-content step="3">
  24. <h1>Testing Server Connection...</h1>
  25. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  26. </v-stepper-content>
  27. <v-stepper-content step="4">
  28. <h1>Checking Browser Information...</h1>
  29. <v-progress-circular indeterminate size="50" width="5" color="primary" />
  30. </v-stepper-content>
  31. <v-stepper-content step="5" style="text-align:left">
  32. <div class="reportHeader">
  33. <h1>Browser</h1>
  34. <v-divider style="transform: translateY(1.5em)" />
  35. </div>
  36. <v-alert dense outlined v-text="notices.browser.text" :type="notices.browser.type" />
  37. <span><b>BROWSER-</b> {{ userInformation.browser.name }}</span><br>
  38. <span><b>VENDOR-</b> {{ userInformation.browser.vendor }} </span><br>
  39. <span><b>VERSION-</b> {{ userInformation.browser.version }}</span><br>
  40. <div class="reportHeader">
  41. <h1>System</h1>
  42. <v-divider style="transform: translateY(1.5em)" />
  43. </div>
  44. <v-alert dense outlined v-text="notices.system.text" :type="notices.system.type" />
  45. <span><b>OS-</b> {{ userInformation.system.os }}</span><br>
  46. <span><b>VERSION-</b> {{ userInformation.system.version }} </span><br>
  47. <span><b>TYPE-</b> {{ userInformation.system.type }}</span><br>
  48. <div class="reportHeader">
  49. <h1>Extension</h1>
  50. <v-divider style="transform: translateY(1.5em)" />
  51. </div>
  52. <v-alert dense outlined v-text="notices.extension.text" :type="notices.extension.type" />
  53. <span><b>RUNNING-</b> {{ userInformation.extension.running ? "Yes" : "Failed to connect"}}</span><br>
  54. <span><b>VERSION-</b> {{ userInformation.extension.version || "Failed to connect"}} </span><br>
  55. <span><b>SERVER CONNECTION-</b>{{ userInformation.extension.serverConnection ? "Working" : "Failed to connect" }}</span><br>
  56. </v-stepper-content>
  57. </v-stepper>
  58. </div>
  59. </template>
  60. <style scoped>
  61. .reportHeader {
  62. display: flex;
  63. margin-top: 1em;
  64. }
  65. </style>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. stepTime: 1000,
  71. supportedBrowsers: ["Firefox", "Chrome", "Brave", "Edge", "Opera"],
  72. progress: 1,
  73. steps: {
  74. one: false,
  75. two: false,
  76. three: false,
  77. four: false,
  78. five: false,
  79. },
  80. userInformation: {
  81. browser: {
  82. name: this.$ua._parsed.name,
  83. vendor: this.$ua._parsed.vendor,
  84. version: this.$ua._parsed.version
  85. },
  86. system: {
  87. os: this.$ua._parsed.os,
  88. version: this.$ua._parsed.os_version,
  89. type: this.$ua._parsed.category
  90. },
  91. extension: {
  92. running: null,
  93. version: null,
  94. serverConnection: null,
  95. latestExtensionVersion: null,
  96. },
  97. },
  98. notices: {
  99. system: {
  100. text: null,
  101. type: null
  102. },
  103. browser: {
  104. text: null,
  105. type: null
  106. },
  107. extension: {
  108. text: null,
  109. type: null
  110. }
  111. }
  112. }
  113. },
  114. mounted() {
  115. const vm = this;
  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. this.userInformation.extension.latestExtensionVersion = res.version;
  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>