subpage.html 17 KB

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