debug.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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>LATEST EXTENSION VERSION-</b> {{ userInformation.extension.latestExtensionVersion || "Failed to lookup data" }}</span><br>
  54. <span><b>SERVER CONNECTION-</b> {{ userInformation.extension.serverConnection ? "Working" : "Failed to connect" }}</span><br>
  55. </v-stepper-content>
  56. </v-stepper>
  57. </div>
  58. </template>
  59. <style scoped>
  60. .reportHeader {
  61. display: flex;
  62. margin-top: 1em;
  63. }
  64. </style>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. stepTime: 2500,
  70. supportedBrowsers: ["Firefox", "Chrome", "Brave", "Edge", "Opera"],
  71. progress: 1,
  72. steps: {
  73. one: false,
  74. two: false,
  75. three: false,
  76. four: false,
  77. five: false,
  78. },
  79. userInformation: {
  80. browser: {
  81. name: this.$ua._parsed.name,
  82. vendor: this.$ua._parsed.vendor,
  83. version: this.$ua._parsed.version
  84. },
  85. system: {
  86. os: this.$ua._parsed.os,
  87. version: this.$ua._parsed.os_version,
  88. type: this.$ua._parsed.category
  89. },
  90. extension: {
  91. serverConnection: null,
  92. latestExtensionVersion: null,
  93. },
  94. },
  95. notices: {
  96. system: {
  97. text: null,
  98. type: null
  99. },
  100. browser: {
  101. text: null,
  102. type: null
  103. },
  104. extension: {
  105. text: null,
  106. type: null
  107. }
  108. }
  109. }
  110. },
  111. mounted() {
  112. //--- Init Stuff ---//
  113. setTimeout(() => {
  114. this.$axios.$get('https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json')
  115. .then(res => {
  116. this.userInformation.extension.latestExtensionVersion = res.version;
  117. })
  118. this.progress++;
  119. this.steps.one = true;
  120. }, this.stepTime);
  121. //--- Check If Extension Is Running ---//
  122. setTimeout(() => {
  123. this.progress++;
  124. this.steps.two = true;
  125. }, this.stepTime * 2);
  126. //--- Check Server Connection ---//
  127. setTimeout(() => {
  128. this.$axios.$get('https://returnyoutubedislikeapi.com/votes?videoId=QOFEgexls14')
  129. .then(res => {
  130. this.userInformation.extension.serverConnection = true;
  131. })
  132. .catch(err => {
  133. this.userInformation.extension.serverConnection = false;
  134. })
  135. this.progress++;
  136. this.steps.three = true;
  137. }, this.stepTime * 3);
  138. setTimeout(() => {
  139. this.progress++;
  140. this.steps.four = true;
  141. //this.steps.five = true;
  142. //--- Parse Extension Data ---//
  143. 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.`;
  144. this.notices.extension.type = "warning";
  145. if (this.userInformation.extension.serverConnection != true) {
  146. this.notices.extension.text = `Failed to connect to the server!`;
  147. this.notices.extension.type = "error";
  148. }
  149. //--- Parse System Compatibility ---//
  150. this.notices.system.text = `${this.userInformation.system.os} is supported!`;
  151. this.notices.system.type = "success";
  152. if (this.userInformation.system.type != "pc") {
  153. this.notices.system.text = `"${this.userInformation.system.type}" may not be a supported device type!`;
  154. this.notices.system.type = "warning";
  155. }
  156. //--- Parse Browser Compatibility ---//
  157. this.notices.browser.text = `${this.userInformation.browser.name} ${this.userInformation.browser.version} is supported!`;
  158. this.notices.browser.type = "success";
  159. if (!this.supportedBrowsers.includes(this.userInformation.browser.name)) {
  160. 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.`;
  161. this.notices.browser.type = "warning";
  162. }
  163. }, this.stepTime * 4);
  164. }
  165. }
  166. </script>