troubleshoot.vue 6.7 KB

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