Skip to content

Commit

Permalink
style: max-len code
Browse files Browse the repository at this point in the history
  • Loading branch information
hansputera committed Nov 24, 2021
1 parent 4f89173 commit 68ce429
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions lib/providers/util/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@ import {client as redisClient} from '../../redis';
* @return {string | undefined}
*/
export const keyGeneratorTTSave = async (token: string): Promise<string> => {
const vm = new NodeVM({
'compiler': 'javascript',
'console': 'inherit',
'require': {
'external': true,
'root': './',
},
});
const vm = new NodeVM({
'compiler': 'javascript',
'console': 'inherit',
'require': {
'external': true,
'root': './',
},
});

let scriptCache = await redisClient.get('ttsave-scripts');
if (!scriptCache) {
const response = await got('https://gist.githubusercontent.com/hansputera/' +
'70e33b8ac4a9beca4725c95cf517e8a6/raw/9b1bf7f0eee16a69b38e203782bd46dae1611f8e/ttsave-gen.js', {
dnsCache: true,
});
let scriptCache = await redisClient.get('ttsave-scripts');
if (!scriptCache) {
const response = await got('https://gist.githubusercontent.com/hansputera/' +
'70e33b8ac4a9beca4725c95cf517e8a6' +
'/raw/9b1bf7f0eee16a69b38e2' +
'03782bd46dae1611f8e/ttsave-gen.js', {
dnsCache: true,
});

await redisClient.set('ttsave-scripts', response.body, 'ex', 60 * 10);
scriptCache = response.body;
}
await redisClient.set('ttsave-scripts', response.body, 'ex', 60 * 10);
scriptCache = response.body;
}

return vm.run(scriptCache + 'module.exports = ' +
return vm.run(scriptCache + 'module.exports = ' +
'key(`' + token + '`);', 'generator-ttsave.js');
};

1 comment on commit 68ce429

@vercel
Copy link

@vercel vercel bot commented on 68ce429 Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.