File tree 1 file changed +13
-14
lines changed
1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 16
16
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
*/
18
18
const AbstractCloudProvider = require ( '../classes/AbstractCloudProvider' ) ;
19
+ const config = require ( '../../config' ) ;
19
20
20
21
module . exports = class LocalCloudProvider extends AbstractCloudProvider {
21
22
constructor ( ) {
22
- super ( token ) ;
23
-
24
- this . token = token ;
23
+ super ( ) ;
25
24
}
26
25
27
- // Validate token
28
26
async validate ( token ) {
29
- if ( this . token === token ) {
30
- return cb ( null , true ) ;
31
- } else {
32
- cb ( new Error ( "token does not match." ) , false ) ;
33
- }
34
-
35
- }
36
- } ;
37
-
27
+ const ok = {
28
+ valid : true ,
29
+ limits : [ ] // No limits
30
+ } ;
31
+
32
+ if ( config . token === "" ) return ok ; // No token required?
33
+ else if ( config . token === token ) return ok ; // Token matches
34
+ else return { valid : false } ; // Token does not match
35
+ }
36
+
38
37
// Always approve
39
38
async approveNewTask ( token , imagesCount ) {
40
39
return { approved : true , error : "" } ;
41
40
}
42
41
43
42
// Do nothing
44
43
async taskFinished ( token , taskInfo ) { }
45
- } ;
44
+ } ;
You can’t perform that action at this time.
0 commit comments