From 73c8c0bd0ad6d76797ccab6b7eddb16d0cd96910 Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:10:15 -0400 Subject: [PATCH 1/6] chore(entrypoint.sh): add command to link public storage using artisan storage:link to ensure access to publicly accessible files --- docker/entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3b6622b..6ad06d2 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -17,11 +17,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then chown -R www-data:www-data ${STORAGE} chmod -R g+rw ${STORAGE} + # Generate key if not set if [ -z "${APP_KEY:-}" -o "$APP_KEY" = "ChangeMeBy32KeyLengthOrGenerated" ]; then ${ARTISAN} key:generate --no-interaction else echo "APP_KEY already set" fi + + # Link public storage + ${ARTISAN} storage:link fi exec "$@" \ No newline at end of file From 32a9c7557d0f36560217e8fd937908d276d81e32 Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:18:59 -0400 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=94=92=20chore(.gitignore):=20update?= =?UTF-8?q?=20.gitignore=20file=20to=20ignore=20additional=20files=20and?= =?UTF-8?q?=20directories=20for=20better=20version=20control=20and=20proje?= =?UTF-8?q?ct=20cleanliness?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dad719f..bcbe3c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,55 @@ +# Ignore PHPUnit cache /src/.phpunit.cache + +# Ignore Node.js modules /src/node_modules + +# Ignore Laravel Mix build directory /src/public/build + +# Ignore Laravel Mix hot module replacement files /src/public/hot + +# Ignore Laravel public storage directory /src/public/storage + +# Ignore Laravel storage encryption keys /src/storage/*.key + +# Ignore Composer vendor directory /src/vendor + +# Ignore application version file /src/version + +# Ignore environment files .env .env.backup .env.production + +# Ignore PHPUnit result cache .phpunit.result.cache + +# Ignore Homestead configuration files Homestead.json Homestead.yaml + +# Ignore Composer auth credentials auth.json + +# Ignore NPM debug log npm-debug.log + +# Ignore Yarn error log yarn-error.log + +# Ignore Fleet configuration /.fleet + +# Ignore IDE-specific files /.idea /.vscode -.idea \ No newline at end of file +.idea + +# Ignore SonarQube scanner workspace +.scannerwork From 00ca5e1b9634c4010a115778eb08645d135ed27b Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:38:12 -0400 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=8E=A8=20style(overrides.css):=20upda?= =?UTF-8?q?te=20body=20background=20color,=20font=20size,=20and=20font=20f?= =?UTF-8?q?amily=20for=20better=20readability=20=F0=9F=8E=A8=20style(overr?= =?UTF-8?q?ides.css):=20update=20form=20label=20font=20weight=20and=20text?= =?UTF-8?q?=20transform=20for=20better=20visibility=20=F0=9F=8E=A8=20style?= =?UTF-8?q?(overrides.css):=20update=20form=20control=20and=20form=20selec?= =?UTF-8?q?t=20styles=20for=20better=20consistency=20and=20usability=20?= =?UTF-8?q?=F0=9F=8E=A8=20style(overrides.css):=20update=20primary=20butto?= =?UTF-8?q?n=20background=20color,=20font=20size,=20padding,=20and=20hover?= =?UTF-8?q?=20state=20for=20better=20aesthetics=20=F0=9F=8E=A8=20style(ove?= =?UTF-8?q?rrides.css):=20update=20hide=20class=20display=20property=20to?= =?UTF-8?q?=20none=20for=20better=20element=20hiding=20=F0=9F=8E=A8=20styl?= =?UTF-8?q?e(overrides.css):=20update=20loading=20class=20position=20and?= =?UTF-8?q?=20background=20color=20for=20better=20loading=20overlay=20?= =?UTF-8?q?=F0=9F=8E=A8=20style(home.blade.php):=20update=20heading=20and?= =?UTF-8?q?=20paragraph=20styles=20for=20better=20readability=20and=20hier?= =?UTF-8?q?archy=20=F0=9F=8E=A8=20style(home.blade.php):=20update=20button?= =?UTF-8?q?=20styles=20for=20better=20consistency=20and=20aesthetics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/lib/css/overrides.css | 64 ++++++++++++++++++------------ src/resources/views/home.blade.php | 18 ++++----- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/public/lib/css/overrides.css b/src/public/lib/css/overrides.css index c231b81..8c3ab89 100644 --- a/src/public/lib/css/overrides.css +++ b/src/public/lib/css/overrides.css @@ -1,39 +1,53 @@ -body{ - /*background: rgb(38, 77, 128)!important;*/ +body { background: rgb(40, 75, 99); - font-size:0.9em; + font-size: 16px; + font-family: Arial, sans-serif; } -.form-label{ - font-weight:700; + +.form-label { + font-weight: 700; text-transform: uppercase; } + .form-control, -.form-select{ - color: rgb(38, 77, 128); - text-transform:uppercase; +.form-select { + color: #26507f; + text-transform: uppercase; outline: none; - font-size:0.9em; + font-size: 1em; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; } -.form-holder{ + +.form-holder { background: rgb(217, 217, 217); } -.btn-primary{ - background:rgb(60, 110, 113); - color: rgb(255, 255, 255); - border:0; - font-size:0.9em; + +.btn-primary { + background: #3c6e71; + color: #fff; + border: 0; + font-size: 1em; + padding: 10px 20px; + border-radius: 4px; + cursor: pointer; +} + +.btn-primary:hover { + background: #2a5255; } -.hide{ - display:none; +.hide { + display: none; } -.loading{ - position:fixed; - top:0; - right:0; - bottom:0; - left:0; - background: rgba(0,0,0,0.5); - z-index:9999; +.loading { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 9999; } \ No newline at end of file diff --git a/src/resources/views/home.blade.php b/src/resources/views/home.blade.php index 7dfedf3..08dbbbf 100644 --- a/src/resources/views/home.blade.php +++ b/src/resources/views/home.blade.php @@ -10,14 +10,14 @@
-

Redbeard's ATIS Generator

-

A simple to use tool for non VATSIM/IVAO/PilotEdge controllers to generate an ATIS in +

Redbeard's ATIS Generator

+

A simple to use tool for non VATSIM/IVAO/PilotEdge controllers to generate an ATIS in text and spoken formats.

-

Other Tools:

-

- Squawk Code Generator | - PDC Generator -

+
@@ -159,7 +159,6 @@ @stop @section('footer') -
@@ -181,7 +180,4 @@
- - - @endsection From 52beda73ace86fba67eff42ee3b3d7b65a65743d Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:40:20 -0400 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=8E=A8=20style(home.blade.php):=20add?= =?UTF-8?q?=20vertical=20margins=20to=20the=20form-holder=20container=20fo?= =?UTF-8?q?r=20better=20spacing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/views/home.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/home.blade.php b/src/resources/views/home.blade.php index 08dbbbf..f07b675 100644 --- a/src/resources/views/home.blade.php +++ b/src/resources/views/home.blade.php @@ -7,7 +7,7 @@
-
+

Redbeard's ATIS Generator

From aec7695fbc8823e05c5e894fb7aa8158535287dc Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:43:24 -0400 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9B=20fix(redbeard.js):=20add=20va?= =?UTF-8?q?lidation=20to=20prevent=20empty=20ICAO=20input=20and=20show=20e?= =?UTF-8?q?rror=20modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/lib/js/redbeard.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/public/lib/js/redbeard.js b/src/public/lib/js/redbeard.js index 078f3f9..acad8db 100644 --- a/src/public/lib/js/redbeard.js +++ b/src/public/lib/js/redbeard.js @@ -82,6 +82,17 @@ $(document).ready(function () { t.preventDefault(); $(".loading").show(); icao = $("#icao").val(); + + // If icao is empty + if (icao == "") { + $("#runway-output").html( + ErrorModal("ICAO cannot be empty.", "runway-modal") + ); + $("#runway-modal").modal("show"); + $(".loading").hide(); + return; + } + $.get(`/api/v1/airports/${icao}/runways`, function (t) { if (t.status == "error" || t.code != 200) { $("#runway-output").html(ErrorModal(t.message, "runway-modal")); From 110b10cbbbaf4222a130f1c8e2298b2a0cebfe75 Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 21 Jul 2023 17:49:35 -0400 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9C=A8feat(redbeard.js):=20add=20comment?= =?UTF-8?q?s=20to=20explain=20the=20purpose=20of=20each=20code=20block=20a?= =?UTF-8?q?nd=20event=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/lib/js/redbeard.js | 169 +++++++++++++++++++++------------- 1 file changed, 104 insertions(+), 65 deletions(-) diff --git a/src/public/lib/js/redbeard.js b/src/public/lib/js/redbeard.js index acad8db..12e5394 100644 --- a/src/public/lib/js/redbeard.js +++ b/src/public/lib/js/redbeard.js @@ -1,13 +1,28 @@ $(document).ready(function () { + // This code attaches an event listener to all input and textarea elements. + // It listens for the "input" event, which occurs when the user types or pastes content into the elements. $("input, textarea").on("input", function () { + // Store the current cursor position (caret position) within the input or textarea element. var t = this.selectionStart, + // Regular expression to match characters that are not alphanumeric (0-9, a-z), + // comma, period, hyphen, forward slash, or whitespace. o = /[^0-9a-z\,\.\-\/\s]/gi, + // Get the current value of the input or textarea element. a = $(this).val(); + + // Check if the value contains any characters that match the regular expression. if (o.test(a)) { + // If there are any matches, replace them with an empty string (remove them from the value). $(this).val(a.replace(o, "")); + + // Since characters were removed, adjust the cursor position to maintain the user's input position. t--; } + + // Check if the input element is not of type "checkbox". if (this.type !== "checkbox") { + // If it's not a checkbox, set the cursor position to the stored value. + // This ensures that the cursor position remains unchanged even after the replacement above. this.setSelectionRange(t, t); } }); @@ -78,59 +93,68 @@ $(document).ready(function () { `; } + // On click event for the element with id "list-runways" $("#list-runways").click(function (t) { - t.preventDefault(); - $(".loading").show(); - icao = $("#icao").val(); + t.preventDefault(); // Prevent default action of the click event + $(".loading").show(); // Show the loading element + icao = $("#icao").val(); // Get the value of the input with id "icao" // If icao is empty if (icao == "") { + // Show an error modal with the message "ICAO cannot be empty." $("#runway-output").html( ErrorModal("ICAO cannot be empty.", "runway-modal") ); - $("#runway-modal").modal("show"); - $(".loading").hide(); - return; + $("#runway-modal").modal("show"); // Show the modal with id "runway-modal" + $(".loading").hide(); // Hide the loading element + return; // Exit the function } + // Make an HTTP GET request to the specified API endpoint $.get(`/api/v1/airports/${icao}/runways`, function (t) { + // Check if the response has an error status or the code is not 200 if (t.status == "error" || t.code != 200) { + // Show an error modal with the received error message $("#runway-output").html(ErrorModal(t.message, "runway-modal")); - $("#runway-modal").modal("show"); - $(".loading").hide(); - return; + $("#runway-modal").modal("show"); // Show the modal with id "runway-modal" + $(".loading").hide(); // Hide the loading element + return; // Exit the function } - // TODO: If not runways show success with overide runways button + // TODO: If no runways, show a success message with an override runways button + // Create a table containing information about runways table = ` - - - - - - - - - - - - ${t.data - .map(function (t) { - return ` +
+ - - - - - + + + + + - `; - }) - .join("")} - -
${t.runway}${t.wind_dir}${t.wind_diff}
- `; + + + ${t.data + .map(function (t) { + // Generate rows for each runway data + return ` + + ${t.runway} + ${t.wind_dir} + ${t.wind_diff} + + + + `; + }) + .join("")} + + + `; + + // Show the generated table in a modal with title and id "runway-modal" $("#runway-output").html( Modal( "Runway List for " + icao.toUpperCase(), @@ -138,38 +162,46 @@ $(document).ready(function () { "runway-modal" ) ); - $("#runway-modal").modal("show"); - $(".loading").hide(); + $("#runway-modal").modal("show"); // Show the modal with id "runway-modal" + $(".loading").hide(); // Hide the loading element }); }); + // On form submit event for the element with id "atis-input" $("#atis-input").submit(function (t) { - $(".loading").show(); - t.preventDefault(); - icao = $("#icao").val(); - ident = $("#ident").val(); + $(".loading").show(); // Show the loading element + t.preventDefault(); // Prevent the default form submission + icao = $("#icao").val(); // Get the value of the input with id "icao" + ident = $("#ident").val(); // Get the value of the input with id "ident" + + // Make an HTTP POST request to the specified API endpoint with serialized form data $.post( `/api/v1/airports/${icao}/atis`, $("#atis-input").serialize(), function (t) { + // Check if the response has an error status or the code is not 200 if (t.status == "error" || t.code != 200) { + // Show an error modal with the received error message $("#atis-output").html(ErrorModal(t.message, "atis-modal")); - $("#atis-modal").modal("show"); - $(".loading").hide(); - return; + $("#atis-modal").modal("show"); // Show the modal with id "atis-modal" + $(".loading").hide(); // Hide the loading element + return; // Exit the function } + // If the response data is empty if (t.data == "") { + // Show an error modal with a specific message $("#atis-output").html( ErrorModal("API returned empty data. Please try again.") ); - $("#atis-modal").modal("show"); - $(".loading").hide(); - return; + $("#atis-modal").modal("show"); // Show the modal with id "atis-modal" + $(".loading").hide(); // Hide the loading element + return; // Exit the function } - atis = t.data.spoken; + atis = t.data.spoken; // Get the spoken data from the response + // HTML template for the success modal success = `