Skip to content

Commit

Permalink
fixed web.telegram.org login issue; fixed doubi web site issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
netptop committed Mar 18, 2020
1 parent 5906215 commit b229810
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ const pathReplace = ({host, httpType, body}) => {
let myRe = new RegExp(`href=([\"\']?)/([-a-z0-9_]+?)`, 'g')
body = body.replace(myRe, `href=$1/${httpType}/${host}/$2`)

myRe = new RegExp(` href=([\"\']?)([-a-z0-9_]+?)`, 'g')
body = body.replace(myRe, ` href=$1/${httpType}/${host}/$2`)

myRe = new RegExp(`href="/"`, 'g')
body = body.replace(myRe, `href="/${httpType}/${host}/"`)

Expand Down Expand Up @@ -194,6 +197,9 @@ const siteSpecificReplace = {
'alt="img/': `alt="/https/www.mitbbs.com/img/`,
'src="[.]/img/': `src="/https/www.mitbbs.com/img/`,
'src="[.]{2}/img/': `src="/https/www.mitbbs.com/img/`,
},
'web.telegram.org': {
' src=([-a-z0-9_]+?)': ` src=/https/github.com/https/web.telegram.org/$1`,
}
}

Expand Down
2 changes: 1 addition & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"functions": {
"api/main.js": {
"memory": 384,
"maxDuration": 4,
"maxDuration": 8,
"includeFiles": "*(*.css|*.png)"
}
},
Expand Down
43 changes: 43 additions & 0 deletions test/siteproxylocal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,46 @@ test('no content-type field situation', async () => {
// console.log(`${response.data}`)
expect(typeof(response.data)).toBe('object')
}, 15000); // should be done within 3 seconds.

test('doubi issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/doubibackup.com`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`href="3x8ussyf.html"`)).toBe(-1)
}, 15000); // should be done within 3 seconds.

test('web.telegram.com href/src issues', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/web.telegram.org`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`href=css/app.css`)).toBe(-1)
expect(response.data.indexOf(`src=js/app.js`)).toBe(-1)
}, 15000); // should be done within 3 seconds.

test('web.telegram.com href/src issues', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/web.telegram.org/js/app.js`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
console.log(`${response.data}`)
expect(response.data.indexOf(`href=/https/github.com/https/web.telegram.org/e.value`)).toBe(-1)
}, 15000); // should be done within 3 seconds.

0 comments on commit b229810

Please sign in to comment.