forked from pablouser1/SignTok
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaa76f0
commit dd6a72e
Showing
9 changed files
with
91 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.vercel | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/.venv | ||
/.vscode | ||
/.idea | ||
/node_modules | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
FROM node:17 | ||
|
||
FROM node:18-alpine | ||
WORKDIR /usr/src/app | ||
|
||
COPY package.json ./ | ||
# Setup Alpine for building "canvas" package | ||
RUN apk add --no-cache python3 make g++ pkgconfig cairo-dev pango-dev | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
COPY . . | ||
|
||
EXPOSE 8080 | ||
CMD [ "node", "api/index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
const Signer = require("../src/Signer") | ||
const http = require("http") | ||
const Signer = require("../src/Signer"); | ||
const http = require("http"); | ||
|
||
const PORT = process.env.PORT || 8080 | ||
const PORT = process.env.PORT || 8080; | ||
|
||
const signer = new Signer() | ||
const signer = new Signer(); | ||
|
||
const server = http.createServer(async (req, res) => { | ||
res.writeHead(200, { | ||
"Content-Type": "application/json", | ||
"Cache-Control": "s-max-age=1, stale-while-revalidate" // caching stuff for vercel | ||
}); | ||
if (req.method === "POST") { | ||
res.writeHead(200, { | ||
"Content-Type": "application/json", | ||
"Cache-Control": "s-max-age=1, stale-while-revalidate" // caching stuff for vercel | ||
}); | ||
|
||
// Get url from POST body | ||
const buffers = []; | ||
for await (const chunk of req) { | ||
buffers.push(chunk); | ||
} | ||
const url = Buffer.concat(buffers).toString(); | ||
|
||
const data = signer.sign(url) | ||
console.log("Sent data from request with url: " + url) | ||
res.write(JSON.stringify({ | ||
status: "ok", | ||
data: { | ||
...data, | ||
navigator: signer.navigator() | ||
} | ||
})); | ||
const data = signer.sign(url); | ||
console.log("Sent data from request with url: " + url); | ||
res.write( | ||
JSON.stringify({ | ||
status: "ok", | ||
data: { | ||
...data, | ||
navigator: signer.navigator() | ||
} | ||
}) | ||
); | ||
} else { | ||
res.write( | ||
JSON.stringify({ | ||
status: "error", | ||
data: "You have to send a POST request with a valid TikTok URL on the body!" | ||
}) | ||
) | ||
} | ||
res.end() | ||
}) | ||
res.end(); | ||
}); | ||
|
||
server.listen(PORT, () => { | ||
console.log(`App listening on port: ${PORT}`); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class Utils { | ||
static verify_fp() { | ||
// TODO, add proper verify fp method | ||
return "verify_68b8ccfa65726db8b3db0cc07821d696" | ||
return "verify_68b8ccfa65726db8b3db0cc07821d696"; | ||
} | ||
} | ||
|
||
module.exports = Utils | ||
module.exports = Utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters