Skip to content

Commit 9b27e24

Browse files
committed
Fix localcloudprovider token checks
1 parent 8479aa7 commit 9b27e24

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

libs/cloud-providers/LocalCloudProvider.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,29 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818
const AbstractCloudProvider = require('../classes/AbstractCloudProvider');
19+
const config = require('../../config');
1920

2021
module.exports = class LocalCloudProvider extends AbstractCloudProvider{
2122
constructor(){
22-
super(token);
23-
24-
this.token = token;
23+
super();
2524
}
2625

27-
// Validate token
2826
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+
3837
// Always approve
3938
async approveNewTask(token, imagesCount){
4039
return {approved: true, error: ""};
4140
}
4241

4342
// Do nothing
4443
async taskFinished(token, taskInfo){}
45-
};
44+
};

0 commit comments

Comments
 (0)