subscription.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. <a-row type="flex" :gutter="[8,8]"
  49. justify="center" style="width:100%">
  50. <a-col :xs="24" :sm="12"
  51. style="text-align:center;">
  52. <tr-qr-box class="qr-box">
  53. <a-tag color="purple"
  54. class="qr-tag">
  55. <span>{{ i18n
  56. "pages.settings.subSettings"}}</span>
  57. </a-tag>
  58. <tr-qr-bg class="qr-bg-sub">
  59. <tr-qr-bg-inner
  60. class="qr-bg-sub-inner">
  61. <canvas id="qrcode"
  62. class="qr-cv"
  63. title='{{ i18n "copy" }}'
  64. @click="copy(app.subUrl)"></canvas>
  65. </tr-qr-bg-inner>
  66. </tr-qr-bg>
  67. </tr-qr-box>
  68. </a-col>
  69. <a-col :xs="24" :sm="12"
  70. style="text-align:center;">
  71. <tr-qr-box class="qr-box">
  72. <a-tag color="purple"
  73. class="qr-tag">
  74. <span>{{ i18n
  75. "pages.settings.subSettings"}}
  76. Json</span>
  77. </a-tag>
  78. <tr-qr-bg class="qr-bg-sub">
  79. <tr-qr-bg-inner
  80. class="qr-bg-sub-inner">
  81. <canvas id="qrcode-subjson"
  82. class="qr-cv"
  83. title='{{ i18n "copy" }}'
  84. @click="copy(app.subJsonUrl)"></canvas>
  85. </tr-qr-bg-inner>
  86. </tr-qr-bg>
  87. </tr-qr-box>
  88. </a-col>
  89. </a-row>
  90. </a-space>
  91. </a-form-item>
  92. <a-form-item>
  93. <a-descriptions bordered :column="1" size="small">
  94. <a-descriptions-item
  95. label='{{ i18n "subscription.subId" }}'>[[
  96. app.sId
  97. ]]</a-descriptions-item>
  98. <a-descriptions-item
  99. label='{{ i18n "subscription.status" }}'>
  100. <template v-if="isUnlimited">
  101. <a-tag color="purple">{{ i18n
  102. "subscription.unlimited" }}</a-tag>
  103. </template>
  104. <template v-else>
  105. <a-tag
  106. :color="isActive ? 'green' : 'red'">[[
  107. isActive ? '{{ i18n
  108. "subscription.active" }}' : '{{ i18n
  109. "subscription.inactive" }}'
  110. ]]</a-tag>
  111. </template>
  112. </a-descriptions-item>
  113. <a-descriptions-item
  114. label='{{ i18n "subscription.downloaded" }}'>[[
  115. app.download
  116. ]]</a-descriptions-item>
  117. <a-descriptions-item
  118. label='{{ i18n "subscription.uploaded" }}'>[[
  119. app.upload
  120. ]]</a-descriptions-item>
  121. <a-descriptions-item
  122. label='{{ i18n "usage" }}'>[[ app.used
  123. ]]</a-descriptions-item>
  124. <a-descriptions-item
  125. label='{{ i18n "subscription.totalQuota" }}'>[[
  126. app.total
  127. ]]</a-descriptions-item>
  128. <a-descriptions-item v-if="app.totalByte > 0"
  129. label='{{ i18n "remained" }}'>[[
  130. app.remained ]]</a-descriptions-item>
  131. <a-descriptions-item
  132. label='{{ i18n "lastOnline" }}'>
  133. <template v-if="app.lastOnlineMs > 0">
  134. <template
  135. v-if="app.datepicker === 'gregorian'">
  136. [[
  137. DateUtil.formatMillis(app.lastOnlineMs)
  138. ]]
  139. </template>
  140. <template v-else>
  141. [[
  142. DateUtil.convertToJalalian(moment(app.lastOnlineMs))
  143. ]]
  144. </template>
  145. </template>
  146. <template v-else>
  147. <span>-</span>
  148. </template>
  149. </a-descriptions-item>
  150. <a-descriptions-item
  151. label='{{ i18n "subscription.expiry" }}'>
  152. <template v-if="app.expireMs === 0">
  153. {{ i18n "subscription.noExpiry" }}
  154. </template>
  155. <template v-else>
  156. <template
  157. v-if="app.datepicker === 'gregorian'">
  158. [[
  159. DateUtil.formatMillis(app.expireMs)
  160. ]]
  161. </template>
  162. <template v-else>
  163. [[
  164. DateUtil.convertToJalalian(moment(app.expireMs))
  165. ]]
  166. </template>
  167. </template>
  168. </a-descriptions-item>
  169. </a-descriptions>
  170. </a-form-item>
  171. </a-form>
  172. <br />
  173. <a-list bordered>
  174. <a-list-item v-for="(link, idx) in links" :key="link">
  175. <div style="width:100%; text-align:center;">
  176. <a-button type="primary" :block="isMobile"
  177. @click="copy(link)">[[ linkName(link, idx)
  178. ]]</a-button>
  179. </div>
  180. </a-list-item>
  181. </a-list>
  182. <br />
  183. <a-form layout="vertical">
  184. <a-form-item>
  185. <a-row type="flex" justify="center" :gutter="[8,8]"
  186. style="width:100%">
  187. <a-col :xs="24" :sm="12"
  188. style="text-align:center;">
  189. <!-- Android dropdown -->
  190. <a-dropdown :trigger="['click']">
  191. <a-button :block="isMobile"
  192. :style="{ marginTop: isMobile ? '6px' : 0 }"
  193. size="large" type="primary">
  194. Android <a-icon type="down" />
  195. </a-button>
  196. <a-menu slot="overlay"
  197. :class="themeSwitcher.currentTheme">
  198. <a-menu-item key="android-v2box"
  199. @click="open('v2box://install-sub?url=' + encodeURIComponent(app.subUrl) + '&name=' + encodeURIComponent(app.sId))">V2Box</a-menu-item>
  200. <a-menu-item key="android-v2rayng"
  201. @click="open('v2rayng://install-config?url=' + encodeURIComponent(app.subUrl))">V2RayNG</a-menu-item>
  202. <a-menu-item key="android-singbox"
  203. @click="copy(app.subUrl)">Sing-box</a-menu-item>
  204. <a-menu-item key="android-v2raytun"
  205. @click="copy(app.subUrl)">V2RayTun</a-menu-item>
  206. <a-menu-item key="android-npvtunnel"
  207. @click="copy(app.subUrl)">NPV
  208. Tunnel</a-menu-item>
  209. </a-menu>
  210. </a-dropdown>
  211. </a-col>
  212. <a-col :xs="24" :sm="12"
  213. style="text-align:center;">
  214. <!-- iOS dropdown -->
  215. <a-dropdown :trigger="['click']">
  216. <a-button :block="isMobile"
  217. :style="{ marginTop: isMobile ? '6px' : 0 }"
  218. size="large" type="primary">
  219. iOS <a-icon type="down" />
  220. </a-button>
  221. <a-menu slot="overlay"
  222. :class="themeSwitcher.currentTheme">
  223. <a-menu-item key="ios-shadowrocket"
  224. @click="open('shadowrocket://add/subscription?url=' + encodeURIComponent(app.subUrl) + '&remark=' + encodeURIComponent(app.sId))">Shadowrocket</a-menu-item>
  225. <a-menu-item key="ios-v2box"
  226. @click="open('v2box://install-sub?url=' + encodeURIComponent(app.subUrl) + '&name=' + encodeURIComponent(app.sId))">V2Box</a-menu-item>
  227. <a-menu-item key="ios-streisand"
  228. @click="open('streisand://import/' + encodeURIComponent(app.subUrl))">Streisand</a-menu-item>
  229. <a-menu-item key="ios-v2raytun"
  230. @click="copy(app.subUrl)">V2RayTun</a-menu-item>
  231. <a-menu-item key="ios-npvtunnel"
  232. @click="copy(app.subUrl)">NPV
  233. Tunnel</a-menu-item>
  234. </a-menu>
  235. </a-dropdown>
  236. </a-col>
  237. </a-row>
  238. </a-form-item>
  239. </a-form>
  240. </a-card>
  241. </a-col>
  242. </a-row>
  243. </a-layout-content>
  244. </a-layout>
  245. <!-- Bootstrap data for external JS -->
  246. <template id="subscription-data" data-sid="{{ .sId }}"
  247. data-sub-url="{{ .subUrl }}" data-subjson-url="{{ .subJsonUrl }}"
  248. data-download="{{ .download }}"
  249. data-upload="{{ .upload }}" data-used="{{ .used }}"
  250. data-total="{{ .total }}" data-remained="{{ .remained }}"
  251. data-expire="{{ .expire }}" data-lastonline="{{ .lastOnline }}"
  252. data-downloadbyte="{{ .downloadByte }}"
  253. data-uploadbyte="{{ .uploadByte }}" data-totalbyte="{{ .totalByte }}"
  254. data-datepicker="{{ .datepicker }}"></template>
  255. <textarea id="subscription-links"
  256. style="display:none">{{ range .result }}{{ . }}
  257. {{ end }}</textarea>
  258. {{template "page/body_scripts" .}}
  259. <script
  260. src="{{ .base_path }}assets/moment/moment-jalali.min.js?{{ .cur_ver }}"></script>
  261. <script
  262. src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script>
  263. {{template "component/aThemeSwitch" .}}
  264. <script src="{{ .base_path }}assets/js/subscription.js?{{ .cur_ver }}"></script>
  265. {{ template "page/body_end" .}}