mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
refactor: remove GitHub authentication API endpoints and add new components
- Deleted GitHub callback and authentication handler files. - Added new component for displaying headlines. - Implemented hot news feed component with external API fetching. - Created dynamic news provider page with routing. - Developed news organization about page with animations and data fetching. - Introduced a code of conduct document.
This commit is contained in:
parent
b35e96625e
commit
930713042e
20 changed files with 861 additions and 599 deletions
|
@ -1,5 +0,0 @@
|
|||
export default defineEventHandler(async (event) => {});
|
||||
|
||||
async function findUser(githubUser: any) {
|
||||
console.log("Github User: " + githubUser);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import crypto from "node:crypto";
|
||||
export default defineEventHandler(async (event) => {
|
||||
const baseUrl = event.node.req.headers.host;
|
||||
const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
|
||||
const clientId = process.env.NUXT_GITHUB_CLIENT_ID;
|
||||
const callbackUrl = `${protocol}://${baseUrl}/api/auth/github/callback`;
|
||||
const state = crypto.randomBytes(16).toString("hex");
|
||||
setCookie(event, "oauth_state", state, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
maxAge: 60 * 10,
|
||||
path: "/",
|
||||
});
|
||||
const authorizationUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(callbackUrl)}&scope=read:user,user:email&state=${state}`;
|
||||
await sendRedirect(event, authorizationUrl, 302);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue