Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TelcoDB
Web Frontend
Commits
0e68df81
Verified
Commit
0e68df81
authored
Oct 22, 2019
by
Elias Ojala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow IDNs on /dns/
parent
f667727c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
src/controllers/dns.controller.ts
src/controllers/dns.controller.ts
+4
-0
src/controllers/search.controller.ts
src/controllers/search.controller.ts
+1
-1
src/functions/isIdn.ts
src/functions/isIdn.ts
+7
-0
No files found.
src/controllers/dns.controller.ts
View file @
0e68df81
...
...
@@ -4,6 +4,8 @@ import isDomainName from "is-domain-name";
import
axios
from
"
axios
"
;
import
getIpInfo
from
"
../functions/getIpInfo
"
;
import
isIp
from
"
is-ip
"
;
import
isIdn
from
"
../functions/isIdn
"
;
import
punycode
from
"
punycode
"
;
const
router
:
Router
=
Router
();
...
...
@@ -43,6 +45,8 @@ router.get("/:domain", (req: Request, res: Response, next: NextFunction) => {
});
})
.
catch
(
next
);
}
else
if
(
isIdn
(
req
.
params
.
domain
))
{
res
.
redirect
(
`/dns/
${
punycode
.
toASCII
(
req
.
params
.
domain
)}
`
)
}
else
{
next
();
}
...
...
src/controllers/search.controller.ts
View file @
0e68df81
...
...
@@ -46,7 +46,7 @@ router.get("/", (req: Request, res: Response, next: NextFunction) => {
resolver
.
resolveNs
(
tld
)
.
then
(
addresses
=>
{
if
(
addresses
.
length
>
2
)
{
res
.
redirect
(
`/tld/
${
tld
}
?from_search=true&orsq=
${
Buffer
.
from
(
query
,
'
utf8
'
).
toString
(
'
base64
'
)}
`
)
res
.
redirect
(
`/tld/
${
tld
}
?from_search=true&orsq=
${
Buffer
.
from
(
query
,
'
utf8
'
).
toString
(
'
base64
'
)}
`
)
;
}
})
.
catch
(
err
=>
{
...
...
src/functions/isIdn.ts
0 → 100644
View file @
0e68df81
import
punycode
from
"
punycode
"
;
function
isIdn
(
domain
:
string
):
boolean
{
return
domain
!==
punycode
.
toASCII
(
domain
);
}
export
default
isIdn
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment