subpage.html 17 KB

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