subscription.html 16 KB

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