troubleshoot.vue 6.7 KB

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