File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,36 @@ function startWebApi(el) {
116
116
} else err ( res )
117
117
} )
118
118
119
+ app . get ( '/jump_forward' , ( req , res ) => {
120
+ if ( req . query . value && ( ( player || { } ) . wcjs || { } ) . time && player . wcjs . length ) {
121
+ const jumpTime = parseInt ( req . query . value )
122
+
123
+ const newTime = player . wcjs . time + jumpTime
124
+
125
+ if ( newTime < player . wcjs . length )
126
+ player . wcjs . time = newTime
127
+ else
128
+ player . wcjs . time = player . wcjs . length - 1000
129
+
130
+ res . send ( 'success' )
131
+ } else err ( res )
132
+ } )
133
+
134
+ app . get ( '/jump_backward' , ( req , res ) => {
135
+ if ( req . query . value && ( ( player || { } ) . wcjs || { } ) . time && player . wcjs . length ) {
136
+ const jumpTime = parseInt ( req . query . value )
137
+
138
+ const newTime = player . wcjs . time - jumpTime
139
+
140
+ if ( newTime > 0 )
141
+ player . wcjs . time = newTime
142
+ else
143
+ player . wcjs . time = 0
144
+
145
+ res . send ( 'success' )
146
+ } else err ( res )
147
+ } )
148
+
119
149
app . get ( '/duration' , ( req , res ) => {
120
150
if ( ( ( player || { } ) . wcjs || { } ) . length ) {
121
151
res . setHeader ( 'Content-Type' , 'application/json; charset=utf-8' )
@@ -211,6 +241,8 @@ function startWebApi(el) {
211
241
} )
212
242
}
213
243
244
+ startWebApi ( '--web-api' )
245
+
214
246
module . exports = {
215
247
process : ( args ) => {
216
248
if ( args . length ) {
You can’t perform that action at this time.
0 commit comments