subscription.html 16 KB

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