Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard committed Feb 1, 2024
1 parent ce67b2f commit ac11e36
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions example/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ app.get('/', (req, res) => {
</style>
</head>
<body class="">
<div style="width: 270px; height: 150px; overflow: hidden;">
<table id="original">
<tr>
Expand Down Expand Up @@ -99,10 +99,34 @@ app.get('/', (req, res) => {
`)
})

app.get('/remote-demo', async (_, res) => {
const response = await fetch('http://localhost:1337/example.ttf')
const buffer = await response.arrayBuffer();

const noscrape = new Noscrape(buffer);

const text = noscrape.obfuscate("this is another demo");

app.listen(1337, () => {
console.log('listen on port', 1337)

res.send(`<html lang="en">
<head>
<title>Noscrape - DEMO</title>
<style>
@font-face {
font-family: 'noscrape-obfuscated';
src: url('data:font/truetype;charset=utf-8;base64,${noscrape.getFont().toString('base64')}');
}
</style>
</head>
<body style="height: 100%; display: flex; justify-content: center; align-items: center;">
<div style="font-family: 'noscrape-obfuscated'">${text}</div>
</body>
</html>
`)
})


app.listen(1337)



0 comments on commit ac11e36

Please sign in to comment.