subpage.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 + ' subscription-page'">
  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="app.subJsonUrl ? 12 : 24"
  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 v-if="app.subJsonUrl" :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. [[ IntlUtil.formatDate(app.lastOnlineMs) ]]
  141. </template>
  142. <template v-else>
  143. <span>-</span>
  144. </template>
  145. </a-descriptions-item>
  146. <a-descriptions-item
  147. label='{{ i18n "subscription.expiry" }}'>
  148. <template v-if="app.expireMs === 0">
  149. {{ i18n "subscription.noExpiry" }}
  150. </template>
  151. <template v-else>
  152. [[ IntlUtil.formatDate(app.expireMs) ]]
  153. </template>
  154. </a-descriptions-item>
  155. </a-descriptions>
  156. </a-form-item>
  157. </a-form>
  158. <br />
  159. <a-list bordered>
  160. <a-list-item v-for="(link, idx) in links" :key="link">
  161. <div style="width:100%; text-align:center;">
  162. <a-button type="primary" :block="isMobile"
  163. @click="copy(link)">[[ linkName(link, idx)
  164. ]]</a-button>
  165. </div>
  166. </a-list-item>
  167. </a-list>
  168. <br />
  169. <a-form layout="vertical">
  170. <a-form-item>
  171. <a-row type="flex" justify="center" :gutter="[8,8]"
  172. style="width:100%">
  173. <a-col :xs="24" :sm="12"
  174. style="text-align:center;">
  175. <!-- Android dropdown -->
  176. <a-dropdown :trigger="['click']">
  177. <a-button icon="android" :block="isMobile"
  178. :style="{ marginTop: isMobile ? '6px' : 0 }"
  179. size="large" type="primary">
  180. Android <a-icon type="down" />
  181. </a-button>
  182. <a-menu slot="overlay"
  183. :class="themeSwitcher.currentTheme">
  184. <a-menu-item key="android-v2box"
  185. @click="open('v2box://install-sub?url=' + encodeURIComponent(app.subUrl) + '&name=' + encodeURIComponent(app.sId))">V2Box</a-menu-item>
  186. <a-menu-item key="android-v2rayng"
  187. @click="open('v2rayng://install-config?url=' + encodeURIComponent(app.subUrl))">V2RayNG</a-menu-item>
  188. <a-menu-item key="android-singbox"
  189. @click="copy(app.subUrl)">Sing-box</a-menu-item>
  190. <a-menu-item key="android-v2raytun"
  191. @click="copy(app.subUrl)">V2RayTun</a-menu-item>
  192. <a-menu-item key="android-npvtunnel"
  193. @click="copy(app.subUrl)">NPV
  194. Tunnel</a-menu-item>
  195. <a-menu-item key="android-happ"
  196. @click="open('happ://add/' + encodeURIComponent(app.subUrl))">Happ</a-menu-item>
  197. </a-menu>
  198. </a-dropdown>
  199. </a-col>
  200. <a-col :xs="24" :sm="12"
  201. style="text-align:center;">
  202. <!-- iOS dropdown -->
  203. <a-dropdown :trigger="['click']">
  204. <a-button icon="apple" :block="isMobile"
  205. :style="{ marginTop: isMobile ? '6px' : 0 }"
  206. size="large" type="primary">
  207. iOS <a-icon type="down" />
  208. </a-button>
  209. <a-menu slot="overlay"
  210. :class="themeSwitcher.currentTheme">
  211. <a-menu-item key="ios-shadowrocket"
  212. @click="open(shadowrocketUrl)">Shadowrocket</a-menu-item>
  213. <a-menu-item key="ios-v2box"
  214. @click="open(v2boxUrl)">V2Box</a-menu-item>
  215. <a-menu-item key="ios-streisand"
  216. @click="open(streisandUrl)">Streisand</a-menu-item>
  217. <a-menu-item key="ios-v2raytun"
  218. @click="copy(v2raytunUrl)">V2RayTun</a-menu-item>
  219. <a-menu-item key="ios-npvtunnel"
  220. @click="copy(npvtunUrl)">NPV
  221. Tunnel
  222. </a-menu-item>
  223. <a-menu-item key="ios-happ"
  224. @click="open(happUrl)">Happ</a-menu-item>
  225. </a-menu>
  226. </a-dropdown>
  227. </a-col>
  228. </a-row>
  229. </a-form-item>
  230. </a-form>
  231. </a-card>
  232. </a-col>
  233. </a-row>
  234. </a-layout-content>
  235. </a-layout>
  236. <!-- Bootstrap data for external JS -->
  237. <template id="subscription-data" data-sid="{{ .sId }}"
  238. data-sub-url="{{ .subUrl }}" data-subjson-url="{{ .subJsonUrl }}"
  239. data-download="{{ .download }}"
  240. data-upload="{{ .upload }}" data-used="{{ .used }}"
  241. data-total="{{ .total }}" data-remained="{{ .remained }}"
  242. data-expire="{{ .expire }}" data-lastonline="{{ .lastOnline }}"
  243. data-downloadbyte="{{ .downloadByte }}"
  244. data-uploadbyte="{{ .uploadByte }}" data-totalbyte="{{ .totalByte }}"
  245. data-datepicker="{{ .datepicker }}"></template>
  246. <textarea id="subscription-links"
  247. style="display:none">{{ range .result }}{{ . }}
  248. {{ end }}</textarea>
  249. {{template "component/aThemeSwitch" .}}
  250. <script src="{{ .base_path }}assets/js/subscription.js?{{ .cur_ver }}"></script>
  251. {{ template "page/body_end" .}}