Updated /.github/workflows/deploy.yml

This commit is contained in:
Hayden Hargreaves 2025-03-05 21:51:25 -07:00
parent f966771ac7
commit 27fb16e404
3 changed files with 20 additions and 6 deletions

View File

@ -34,7 +34,7 @@ const INVALID_EXTS: string[] = ["exe", "dll", "obj", "lib", "bin", "dat", "pdf",
* TODO: Update hosts for production * TODO: Update hosts for production
*/ */
const corsOptions: cors.CorsOptions = { const corsOptions: cors.CorsOptions = {
origin: ["http://localhost:3100", "https://192.168.1.211:3100"], origin: ["http://localhost:3100", "http://192.168.1.211:3100"],
methods: ["GET", "POST"] methods: ["GET", "POST"]
}; };
APP.use(cors()); APP.use(cors());
@ -71,6 +71,8 @@ v1.post("/login", (req: Request, res: Response): void => {
// Get info from body // Get info from body
const {username, password} = req.body; const {username, password} = req.body;
console.log("I GOT HIT BABY!!!");
// Get required info from the environment and validate // Get required info from the environment and validate
// TODO: Make sure the ENV is sourced through docker compose! // TODO: Make sure the ENV is sourced through docker compose!
if (process.env["FILE_GOPHERNEST_USER"] === username && validateHash(password, process.env["FILE_GOPHERNEST_PASSWORD"] as string)) { if (process.env["FILE_GOPHERNEST_USER"] === username && validateHash(password, process.env["FILE_GOPHERNEST_PASSWORD"] as string)) {

View File

@ -5,6 +5,12 @@ import RememberMe from "./RememberMe.jsx";
import {useNavigate} from "react-router-dom"; import {useNavigate} from "react-router-dom";
export default function LoginForm() { export default function LoginForm() {
/**
* URL To the backend web server
* @type {string}
*/
const backendUrl = "http://backend:5000";
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
const [remember, setRemember] = useState(false); const [remember, setRemember] = useState(false);
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
@ -56,7 +62,7 @@ export default function LoginForm() {
// TODO: There is no validation yet, need to implement that // TODO: There is no validation yet, need to implement that
const sendAuthReq = async (username, password) => { const sendAuthReq = async (username, password) => {
const resp = await fetch("http://localhost:5000/v1/login", { const resp = await fetch(`${backendUrl}/v1/login`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

View File

@ -10,6 +10,12 @@ export default function Dashboard() {
// Store the default path // Store the default path
const defaultPath = ["home", "azpect", "Documents"]; const defaultPath = ["home", "azpect", "Documents"];
/**
* URL To the backend web server
* @type {string}
*/
const backendUrl = "http://backend:5000";
const [token, setToken] = useState(null); const [token, setToken] = useState(null);
const [path, setPath] = useState([...defaultPath]); const [path, setPath] = useState([...defaultPath]);
const [showHidden, setShowHidden] = useState(false); const [showHidden, setShowHidden] = useState(false);
@ -40,7 +46,7 @@ export default function Dashboard() {
useEffect(() => { useEffect(() => {
const getData = async (token) => { const getData = async (token) => {
const response = await fetch(`http://localhost:5000/v1/children?path=/${path.join("/")}`, { const response = await fetch(`${backendUrl}/v1/children?path=/${path.join("/")}`, {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -138,7 +144,7 @@ export default function Dashboard() {
const download = async (paths) => { const download = async (paths) => {
try { try {
const resp = await fetch("http://localhost:5000/v1/download", { const resp = await fetch(`${backendUrl}/v1/download`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -193,7 +199,7 @@ export default function Dashboard() {
const exitAndSaveFile = (newContent) => { const exitAndSaveFile = (newContent) => {
const updateContent = async (path, content) => { const updateContent = async (path, content) => {
const resp = await fetch("http://localhost:5000/v1/update", { const resp = await fetch(`${backendUrl}/v1/update`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -222,7 +228,7 @@ export default function Dashboard() {
const [editingFileContent, setEditingFileContent] = useState(""); const [editingFileContent, setEditingFileContent] = useState("");
useEffect(() => { useEffect(() => {
const fetchContent = async (path) => { const fetchContent = async (path) => {
const resp = await fetch(`http://localhost:5000/v1/content?path=${path}`, { const resp = await fetch(`${backendUrl}/v1/content?path=${path}`, {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",