78 lines
2.3 KiB
JavaScript
78 lines
2.3 KiB
JavaScript
Vue.component("http-hls-config-box", {
|
||
props: ["value", "v-is-location", "v-is-group"],
|
||
data: function () {
|
||
let config = this.value
|
||
if (config == null) {
|
||
config = {
|
||
isPrior: false
|
||
}
|
||
}
|
||
|
||
let encryptingConfig = config.encrypting
|
||
if (encryptingConfig == null) {
|
||
encryptingConfig = {
|
||
isOn: false,
|
||
onlyURLPatterns: [],
|
||
exceptURLPatterns: []
|
||
}
|
||
config.encrypting = encryptingConfig
|
||
}
|
||
|
||
return {
|
||
config: config,
|
||
|
||
encryptingConfig: encryptingConfig,
|
||
encryptingMoreOptionsVisible: false
|
||
}
|
||
},
|
||
methods: {
|
||
isOn: function () {
|
||
return ((!this.vIsLocation && !this.vIsGroup) || this.config.isPrior)
|
||
},
|
||
|
||
showEncryptingMoreOptions: function () {
|
||
this.encryptingMoreOptionsVisible = !this.encryptingMoreOptionsVisible
|
||
}
|
||
},
|
||
template: `<div>
|
||
<input type="hidden" name="hlsJSON" :value="JSON.stringify(config)"/>
|
||
<table class="ui table definition selectable" v-show="vIsLocation || vIsGroup">
|
||
<prior-checkbox :v-config="config" v-if="vIsLocation || vIsGroup"></prior-checkbox>
|
||
</table>
|
||
|
||
<table class="ui table definition selectable" v-show="isOn()">
|
||
<tbody>
|
||
<tr>
|
||
<td class="title">启用HLS加密配置</td>
|
||
<td>
|
||
<checkbox v-model="encryptingConfig.isOn"></checkbox>
|
||
<p class="comment">启用后,系统会自动在<code-label>.m3u8</code-label>文件中加入<code-label>#EXT-X-KEY:METHOD=AES-128...</code-label>,并将其中的<code-label>.ts</code-label>文件内容进行加密。</p>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody v-show="encryptingConfig.isOn">
|
||
<tr>
|
||
<td colspan="2"><more-options-indicator @change="showEncryptingMoreOptions"></more-options-indicator></td>
|
||
</tr>
|
||
</tbody>
|
||
<tbody v-show="encryptingConfig.isOn && encryptingMoreOptionsVisible">
|
||
<tr>
|
||
<td>例外URL</td>
|
||
<td>
|
||
<url-patterns-box v-model="encryptingConfig.exceptURLPatterns"></url-patterns-box>
|
||
<p class="comment">如果填写了例外URL,表示这些URL跳过不做处理。</p>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>限制URL</td>
|
||
<td>
|
||
<url-patterns-box v-model="encryptingConfig.onlyURLPatterns"></url-patterns-box>
|
||
<p class="comment">如果填写了限制URL,表示只对这些URL进行加密处理;如果不填则表示支持所有的URL。</p>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="margin"></div>
|
||
</div>`
|
||
})
|