diff --git a/rules.json b/rules.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/rules.json @@ -0,0 +1 @@ +[] diff --git a/timemachine.js b/timemachine.js index 13f7fa0..feddd8b 100644 --- a/timemachine.js +++ b/timemachine.js @@ -19,10 +19,11 @@ 'use strict'; const TAG = '[chzzk-bypass:timemachine]'; - const LIVE_DETAIL_RE = /^https:\/\/api\.chzzk\.naver\.com\/service\/v\d+\/channels\/([^\/?#]+)\/live-detail/; + // 치지직은 `service/v3.2/...` 처럼 minor 가 붙은 버전을 쓴다. 점(.) 포함 허용. + const LIVE_DETAIL_RE = /^https:\/\/api\.chzzk\.naver\.com\/service\/v[\d.]+\/channels\/([^\/?#]+)\/live-detail/; - // 일부 빌드에서는 v3, 어떤 시점에는 v2/v1 만 응답하므로 순차 시도한다. - const PLAYBACK_JSON_VERSIONS = ['v3', 'v2', 'v1']; + // 시점/빌드별로 다른 버전이 응답하므로 순차 시도한다. + const PLAYBACK_JSON_VERSIONS = ['v3.2', 'v3.1', 'v3', 'v2', 'v1']; function log() { try { @@ -78,7 +79,12 @@ const content = data && data.content; if (!content) return response; - const alreadyOn = content.timeMachineActive === true || content.timeMachine === true; + // 치지직 live-detail 응답에는 두 개의 별개 플래그가 존재한다. + // - timeMachineActive : 채널/방송 단위 타임머신 활성 여부 + // - timeMachinePlayback : 플레이어가 실제 되감기 UI 를 켤지 결정하는 플래그 + // 둘 중 어느 하나라도 false 면 UI 가 안 뜨므로 둘 다 true 로 만든다. + // (참고: github.com/jaesung9507/nvver chzzk/live.go LiveDetail 구조체) + const alreadyOn = content.timeMachineActive === true && content.timeMachinePlayback === true; const channelId = (content.channel && content.channel.channelId) || channelIdFromUrl; if (alreadyOn) { @@ -88,7 +94,7 @@ log('forcing timeMachine ON for', channelId); content.timeMachineActive = true; - content.timeMachine = true; + content.timeMachinePlayback = true; // DVR 매니페스트로 교체 시도. 실패해도 플래그는 살려서 UI 만이라도 노출. if (channelId) {