1
0

subpage.html 16 KB

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