1
0

subpage.html 17 KB

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