mirror of
https://github.com/wechaty/getting-started.git
synced 2026-10-16 21:12:46 +08:00
clean codesandbox
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
const isCodeSandbox = () => Object.keys(process.env).filter(k => /KUBERNETES/i.test(k)).length > 0
|
||||
|
||||
if (isCodeSandbox()) {
|
||||
/**
|
||||
* A quick webserver
|
||||
*/
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const connect = require('connect')
|
||||
const marked = require('marked')
|
||||
|
||||
const readme = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'README.md',
|
||||
)
|
||||
|
||||
connect()
|
||||
.use((_, res) => res.end(marked(fs.readFileSync(readme).toString())))
|
||||
.listen(8080, function() {
|
||||
console.info('Web Server running on 8080...')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,11 +8,6 @@ const {
|
||||
log,
|
||||
} = require('wechaty')
|
||||
|
||||
/**
|
||||
* You can ignore the next line becasue it is using for CodeSandbox
|
||||
*/
|
||||
require('./.code-sandbox.js')
|
||||
|
||||
function onScan (qrcode, status) {
|
||||
if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
|
||||
require('qrcode-terminal').generate(qrcode, { small: true }) // show qrcode on console
|
||||
|
||||
@@ -14,9 +14,6 @@ import { generate } from 'qrcode-terminal'
|
||||
|
||||
require('dotenv').config()
|
||||
|
||||
// You can safely ignore / comment out the next two lines because it is using for CodeSandbox
|
||||
require('./.code-sandbox.js')
|
||||
|
||||
function onScan (qrcode: string, status: ScanStatus) {
|
||||
if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
|
||||
generate(qrcode, { small: true }) // show qrcode on console
|
||||
|
||||
Reference in New Issue
Block a user