subscription.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. {{ template "page/head_start" .}}
  2. {{ template "page/head_end" .}}
  3. {{ template "page/body_start" .}}
  4. <a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
  5. <a-layout-content class="p-2">
  6. <a-row type="flex" justify="center" class="mt-2">
  7. <a-col :xs="24" :sm="22" :md="18" :lg="14" :xl="12">
  8. <a-card hoverable class="subscription-card">
  9. <template #title>
  10. <a-space>
  11. <span>{{ i18n "subscription.title" }}</span>
  12. <a-tag>{{ .sId }}</a-tag>
  13. </a-space>
  14. </template>
  15. <template #extra>
  16. <a-popover
  17. :overlay-class-name="themeSwitcher.currentTheme"
  18. title='{{ i18n "menu.settings" }}'
  19. placement="bottomRight" trigger="click">
  20. <template #content>
  21. <a-space direction="vertical" :size="10">
  22. <a-theme-switch-login></a-theme-switch-login>
  23. <span>{{ i18n "pages.settings.language"
  24. }}</span>
  25. <a-select ref="selectLang" class="w-100"
  26. v-model="lang"
  27. @change="LanguageManager.setLanguage(lang)"
  28. :dropdown-class-name="themeSwitcher.currentTheme">
  29. <a-select-option :value="l.value"
  30. label="English"
  31. v-for="l in LanguageManager.supportedLanguages"
  32. :key="l.value">
  33. <span role="img"
  34. :aria-label="l.name"
  35. v-text="l.icon"></span>
  36. &nbsp;&nbsp;<span
  37. v-text="l.name"></span>
  38. </a-select-option>
  39. </a-select>
  40. </a-space>
  41. </template>
  42. <a-button shape="circle" icon="setting"></a-button>
  43. </a-popover>
  44. </template>
  45. <a-form layout="vertical">
  46. <a-form-item>
  47. <a-space direction="vertical" align="center">
  48. <tr-qr-box class="qr-box">
  49. <tr-qr-bg class="qr-bg-sub">
  50. <tr-qr-bg-inner class="qr-bg-sub-inner">
  51. <canvas id="qrcode" class="qr-cv"
  52. title='{{ i18n "copy" }}'
  53. @click="copy(app.subUrl)"></canvas>
  54. </tr-qr-bg-inner>
  55. </tr-qr-bg>
  56. </tr-qr-box>
  57. </a-space>
  58. </a-form-item>
  59. <a-form-item>
  60. <a-descriptions bordered :column="1" size="small">
  61. <a-descriptions-item
  62. label='{{ i18n "subscription.subId" }}'>[[
  63. app.sId
  64. ]]</a-descriptions-item>
  65. <a-descriptions-item
  66. label='{{ i18n "subscription.status" }}'>
  67. <template v-if="isUnlimited">
  68. <a-tag color="purple">{{ i18n
  69. "subscription.unlimited" }}</a-tag>
  70. </template>
  71. <template v-else>
  72. <a-tag
  73. :color="isActive ? 'green' : 'red'">[[
  74. isActive ? '{{ i18n
  75. "subscription.active" }}' : '{{ i18n
  76. "subscription.inactive" }}'
  77. ]]</a-tag>
  78. </template>
  79. </a-descriptions-item>
  80. <a-descriptions-item
  81. label='{{ i18n "subscription.downloaded" }}'>[[
  82. app.download
  83. ]]</a-descriptions-item>
  84. <a-descriptions-item
  85. label='{{ i18n "subscription.uploaded" }}'>[[
  86. app.upload
  87. ]]</a-descriptions-item>
  88. <a-descriptions-item
  89. label='{{ i18n "usage" }}'>[[ app.used
  90. ]]</a-descriptions-item>
  91. <a-descriptions-item
  92. label='{{ i18n "subscription.totalQuota" }}'>[[
  93. app.total
  94. ]]</a-descriptions-item>
  95. <a-descriptions-item v-if="app.totalByte > 0"
  96. label='{{ i18n "remained" }}'>[[
  97. app.remained ]]</a-descriptions-item>
  98. <a-descriptions-item
  99. label='{{ i18n "lastOnline" }}'>
  100. <template v-if="app.lastOnlineMs > 0">
  101. <template
  102. v-if="app.datepicker === 'gregorian'">
  103. [[
  104. DateUtil.formatMillis(app.lastOnlineMs)
  105. ]]
  106. </template>
  107. <template v-else>
  108. [[
  109. DateUtil.convertToJalalian(moment(app.lastOnlineMs))
  110. ]]
  111. </template>
  112. </template>
  113. <template v-else>
  114. <span>-</span>
  115. </template>
  116. </a-descriptions-item>
  117. <a-descriptions-item
  118. label='{{ i18n "subscription.expiry" }}'>
  119. <template v-if="app.expireMs === 0">
  120. {{ i18n "subscription.noExpiry" }}
  121. </template>
  122. <template v-else>
  123. <template
  124. v-if="app.datepicker === 'gregorian'">
  125. [[
  126. DateUtil.formatMillis(app.expireMs)
  127. ]]
  128. </template>
  129. <template v-else>
  130. [[
  131. DateUtil.convertToJalalian(moment(app.expireMs))
  132. ]]
  133. </template>
  134. </template>
  135. </a-descriptions-item>
  136. </a-descriptions>
  137. </a-form-item>
  138. </a-form>
  139. <br />
  140. <a-list bordered>
  141. <a-list-item v-for="(link, idx) in links" :key="link">
  142. <div style="width:100%; text-align:center;">
  143. <a-button type="primary" :block="isMobile"
  144. @click="copy(link)">[[ linkName(link, idx)
  145. ]]</a-button>
  146. </div>
  147. </a-list-item>
  148. </a-list>
  149. <br />
  150. <a-form layout="vertical">
  151. <a-form-item>
  152. <a-row type="flex" justify="center" :gutter="[8,8]"
  153. style="width:100%">
  154. <a-col :xs="24" :sm="12"
  155. style="text-align:center;">
  156. <!-- Android dropdown -->
  157. <a-dropdown :trigger="['click']">
  158. <a-button :block="isMobile"
  159. :style="{ marginTop: isMobile ? '6px' : 0 }"
  160. size="large" type="primary">
  161. Android <a-icon type="down" />
  162. </a-button>
  163. <a-menu slot="overlay"
  164. :class="themeSwitcher.currentTheme">
  165. <a-menu-item key="android-v2box"
  166. @click="open('v2box://install-sub?url=' + encodeURIComponent(app.subUrl) + '&name=' + encodeURIComponent(app.sId))">V2Box</a-menu-item>
  167. <a-menu-item key="android-streisand"
  168. @click="open('streisand://import/' + encodeURIComponent(app.subUrl))">streisand</a-menu-item>
  169. <a-menu-item key="android-v2rayng"
  170. @click="open('v2rayng://install-config?url=' + encodeURIComponent(app.subUrl))">V2RayNG</a-menu-item>
  171. <a-menu-item key="android-v2raytun"
  172. @click="copy(app.subUrl)">V2RayTun</a-menu-item>
  173. <a-menu-item key="android-npvtunnel"
  174. @click="copy(app.subUrl)">NPV Tunnel</a-menu-item>
  175. </a-menu>
  176. </a-dropdown>
  177. </a-col>
  178. <a-col :xs="24" :sm="12"
  179. style="text-align:center;">
  180. <!-- iOS dropdown -->
  181. <a-dropdown :trigger="['click']">
  182. <a-button :block="isMobile"
  183. :style="{ marginTop: isMobile ? '6px' : 0 }"
  184. size="large" type="primary">
  185. iOS <a-icon type="down" />
  186. </a-button>
  187. <a-menu slot="overlay"
  188. :class="themeSwitcher.currentTheme">
  189. <a-menu-item key="ios-shadowrocket"
  190. @click="open('shadowrocket://add/subscription?url=' + encodeURIComponent(app.subUrl) + '&remark=' + encodeURIComponent(app.sId))">Shadowrocket</a-menu-item>
  191. <a-menu-item key="ios-v2box"
  192. @click="open('v2box://install-sub?url=' + encodeURIComponent(app.subUrl) + '&name=' + encodeURIComponent(app.sId))">V2Box</a-menu-item>
  193. <a-menu-item key="ios-streisand"
  194. @click="open('streisand://import/' + encodeURIComponent(app.subUrl))">Streisand</a-menu-item>
  195. <a-menu-item key="ios-v2raytun"
  196. @click="copy(app.subUrl)">V2RayTun</a-menu-item>
  197. <a-menu-item key="ios-npvtunnel"
  198. @click="copy(app.subUrl)">NPV Tunnel</a-menu-item>
  199. </a-menu>
  200. </a-dropdown>
  201. </a-col>
  202. </a-row>
  203. </a-form-item>
  204. </a-form>
  205. </a-card>
  206. </a-col>
  207. </a-row>
  208. </a-layout-content>
  209. </a-layout>
  210. <!-- Bootstrap data for external JS -->
  211. <template id="subscription-data" data-sid="{{ .sId }}"
  212. data-sub-url="{{ .subUrl }}" data-download="{{ .download }}"
  213. data-upload="{{ .upload }}" data-used="{{ .used }}"
  214. data-total="{{ .total }}" data-remained="{{ .remained }}"
  215. data-expire="{{ .expire }}" data-lastonline="{{ .lastOnline }}"
  216. data-downloadbyte="{{ .downloadByte }}"
  217. data-uploadbyte="{{ .uploadByte }}" data-totalbyte="{{ .totalByte }}"
  218. data-datepicker="{{ .datepicker }}"></template>
  219. <textarea id="subscription-links"
  220. style="display:none">{{ range .result }}{{ . }}
  221. {{ end }}</textarea>
  222. {{template "page/body_scripts" .}}
  223. <script
  224. src="{{ .base_path }}assets/moment/moment-jalali.min.js?{{ .cur_ver }}"></script>
  225. <script
  226. src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script>
  227. {{template "component/aThemeSwitch" .}}
  228. <script src="{{ .base_path }}assets/js/subscription.js?{{ .cur_ver }}"></script>
  229. {{ template "page/body_end" .}}