Improved start.py + Passwords now use PasswordInput instead of TextInput

This commit is contained in:
DomySh
2022-06-27 09:34:33 +02:00
parent a8ffcb9f72
commit 23f24725c3
5 changed files with 972 additions and 4032 deletions
-3
View File
@@ -1,6 +1,3 @@
from asyncore import file_dispatcher
from imp import reload
from pstats import Stats
from proxy import Filter, Proxy
import random, string, os, threading, sqlite3, time, atexit, socket
from kthread import KThread
+929 -4017
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,4 +1,4 @@
import { Button, Group, Loader, LoadingOverlay, Notification, Space, TextInput, Title } from '@mantine/core';
import { Button, Group, Loader, LoadingOverlay, Notification, Space, PasswordInput, Title } from '@mantine/core';
import { useForm } from '@mantine/hooks';
import React, { useEffect, useState } from 'react';
import { ImCross } from 'react-icons/im';
@@ -76,7 +76,7 @@ function App() {
<Title order={3} align="center">Setup: Choose the password for access to the firewall 🔒</Title>
<Space h="xl" />
<form onSubmit={form.onSubmit(submitRequest)} style={{width:"80%"}}>
<TextInput
<PasswordInput
label="Password"
placeholder="$3cr3t"
{...form.getInputProps('password')}
@@ -111,7 +111,7 @@ function App() {
<Title order={2} align="center">Before you use the firewall, insert the password 🔒</Title>
<Space h="xl" />
<form onSubmit={form.onSubmit(submitRequest)} style={{width:"80%"}}>
<TextInput
<PasswordInput
label="Password"
placeholder="$3cr3t"
{...form.getInputProps('password')}
+2 -2
View File
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { ActionIcon, Badge, Button, Divider, Group, Image, Menu, Modal, Notification, Space, Switch, TextInput, Tooltip, FloatingTooltip, MediaQuery } from '@mantine/core';
import { ActionIcon, Badge, Button, Divider, Group, Image, Menu, Modal, Notification, Space, Switch, TextInput, Tooltip, FloatingTooltip, MediaQuery, PasswordInput } from '@mantine/core';
import style from "./Header.module.scss";
import { changepassword, errorNotify, eventUpdateName, generalstats, logout, okNotify } from '../../js/utils';
import { ChangePassword, GeneralStats } from '../../js/models';
@@ -146,7 +146,7 @@ function Header() {
<form onSubmit={form.onSubmit(submitRequest)}>
<Space h="md" />
<TextInput
<PasswordInput
label="New Password"
placeholder="$3cr3t"
{...form.getInputProps('password')}
+38 -7
View File
@@ -1,11 +1,34 @@
#!/usr/bin/env python3
import argparse, sys, platform
import argparse, sys, platform, os
pref = "\033["
reset = f"{pref}0m"
class colors:
black = "30m"
red = "31m"
green = "32m"
yellow = "33m"
blue = "34m"
magenta = "35m"
cyan = "36m"
white = "37m"
def puts(text, *args, color=colors.white, is_bold=False, **kwargs):
print(f'{pref}{1 if is_bold else 0};{color}' + text + reset, *args, **kwargs)
def sep(): puts("-----------------------------------", is_bold=True)
parser = argparse.ArgumentParser()
parser.add_argument('port', type=int, help='Port where open the web service of the firewall')
parser.add_argument('--port', "-p", type=int, required=False, help='Port where open the web service of the firewall', default=4444)
parser.add_argument('--no-autostart', "-n", required=False, action="store_true", help='Auto-execute "docker-compose up -d --build"', default=False)
args = parser.parse_args()
sep()
puts(f"Firegex", color=colors.yellow, end="")
puts(" will start on port ", end="")
puts(f"{args.port}", color=colors.cyan)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
with open("docker-compose.yml","wt") as compose:
@@ -23,11 +46,11 @@ services:
volumes:
- /execute/db
""")
print("Done! You can start firegex with docker-compose up -d --build")
#print("Done! You can start firegex with docker-compose up -d --build")
else:
print("-----------------------------------")
print("You are not in a linux machine, due to docker limitation on other platform, the firewall will not work in this machine. You will only see the interface of firegex.")
print("-----------------------------------")
sep()
puts("--- WARNING ---", color=colors.yellow)
puts("You are not in a linux machine, due to docker limitation on other platform, the firewall will not work in this machine. You will only see the interface of firegex.", color=colors.red)
compose.write(f"""
version: '3.9'
@@ -45,4 +68,12 @@ services:
extra_hosts:
- host.docker.internal:host-gateway
""")
print("Done! You can start firegex with docker-compose up -d --build")
#
sep()
if not args.no_autostart:
puts("Running 'docker-compose up -d --build'\n", color=colors.green)
os.system("docker-compose up -d --build")
else:
puts("Done! You can start firegex with docker-compose up -d --build", color=colors.yellow)
sep()