Compare commits
No commits in common. "rails-rewrite" and "master" have entirely different histories.
rails-rewr
...
master
243 changed files with 14140 additions and 1693 deletions
28
.env.example
Normal file
28
.env.example
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=laravel
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
LASTFM_KEY=
|
||||||
|
LASTFM_USER=
|
||||||
16
.gitattributes
vendored
16
.gitattributes
vendored
|
|
@ -1,9 +1,11 @@
|
||||||
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
|
* text=auto eol=lf
|
||||||
|
|
||||||
# Mark the database schema as having been generated.
|
*.blade.php diff=html
|
||||||
db/schema.rb linguist-generated
|
*.css diff=css
|
||||||
|
*.html diff=html
|
||||||
|
*.md diff=markdown
|
||||||
|
*.php diff=php
|
||||||
|
|
||||||
# Mark any vendored files as having been vendored.
|
/.github export-ignore
|
||||||
vendor/* linguist-vendored
|
CHANGELOG.md export-ignore
|
||||||
config/credentials/*.yml.enc diff=rails_credentials
|
.styleci.yml export-ignore
|
||||||
config/credentials.yml.enc diff=rails_credentials
|
|
||||||
|
|
|
||||||
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
* @RoscoeDaWah
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -22,9 +22,3 @@ yarn-error.log
|
||||||
/storage
|
/storage
|
||||||
/tmp
|
/tmp
|
||||||
/public/pub
|
/public/pub
|
||||||
|
|
||||||
.old
|
|
||||||
|
|
||||||
# Ignore master key for decrypting credentials and more.
|
|
||||||
/config/master.key
|
|
||||||
/config/credentials.yml.enc
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
ruby-3.4.1
|
|
||||||
5
.run/Development Server (External).run.xml
Normal file
5
.run/Development Server (External).run.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Development Server (External)" type="PhpLocalRunConfigurationType" factoryName="PHP Console" path="$PROJECT_DIR$/artisan" scriptParameters="serve --host 0.0.0.0 --port 8000">
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
5
.run/Development Server.run.xml
Normal file
5
.run/Development Server.run.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Development Server" type="PhpLocalRunConfigurationType" factoryName="PHP Console" path="$PROJECT_DIR$/artisan" scriptParameters="serve">
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
20
Gemfile
20
Gemfile
|
|
@ -1,20 +0,0 @@
|
||||||
source "https://rubygems.org"
|
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
|
||||||
gem "rails", "~> 8.0.2", ">= 8.0.2.1"
|
|
||||||
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
|
|
||||||
gem "propshaft"
|
|
||||||
# Use sqlite3 as the database for Active Record
|
|
||||||
gem "sqlite3", ">= 2.1"
|
|
||||||
# Use the Puma web server [https://github.com/puma/puma]
|
|
||||||
gem "puma", ">= 5.0"
|
|
||||||
|
|
||||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
||||||
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
|
||||||
|
|
||||||
gem "view_component"
|
|
||||||
|
|
||||||
group :development, :test do
|
|
||||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
||||||
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
|
||||||
end
|
|
||||||
239
Gemfile.lock
239
Gemfile.lock
|
|
@ -1,239 +0,0 @@
|
||||||
GEM
|
|
||||||
remote: https://rubygems.org/
|
|
||||||
specs:
|
|
||||||
actioncable (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
nio4r (~> 2.0)
|
|
||||||
websocket-driver (>= 0.6.1)
|
|
||||||
zeitwerk (~> 2.6)
|
|
||||||
actionmailbox (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
activejob (= 8.0.2.1)
|
|
||||||
activerecord (= 8.0.2.1)
|
|
||||||
activestorage (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
mail (>= 2.8.0)
|
|
||||||
actionmailer (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
actionview (= 8.0.2.1)
|
|
||||||
activejob (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
mail (>= 2.8.0)
|
|
||||||
rails-dom-testing (~> 2.2)
|
|
||||||
actionpack (8.0.2.1)
|
|
||||||
actionview (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
nokogiri (>= 1.8.5)
|
|
||||||
rack (>= 2.2.4)
|
|
||||||
rack-session (>= 1.0.1)
|
|
||||||
rack-test (>= 0.6.3)
|
|
||||||
rails-dom-testing (~> 2.2)
|
|
||||||
rails-html-sanitizer (~> 1.6)
|
|
||||||
useragent (~> 0.16)
|
|
||||||
actiontext (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
activerecord (= 8.0.2.1)
|
|
||||||
activestorage (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
globalid (>= 0.6.0)
|
|
||||||
nokogiri (>= 1.8.5)
|
|
||||||
actionview (8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
builder (~> 3.1)
|
|
||||||
erubi (~> 1.11)
|
|
||||||
rails-dom-testing (~> 2.2)
|
|
||||||
rails-html-sanitizer (~> 1.6)
|
|
||||||
activejob (8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
globalid (>= 0.3.6)
|
|
||||||
activemodel (8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
activerecord (8.0.2.1)
|
|
||||||
activemodel (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
timeout (>= 0.4.0)
|
|
||||||
activestorage (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
activejob (= 8.0.2.1)
|
|
||||||
activerecord (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
marcel (~> 1.0)
|
|
||||||
activesupport (8.0.2.1)
|
|
||||||
base64
|
|
||||||
benchmark (>= 0.3)
|
|
||||||
bigdecimal
|
|
||||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
||||||
connection_pool (>= 2.2.5)
|
|
||||||
drb
|
|
||||||
i18n (>= 1.6, < 2)
|
|
||||||
logger (>= 1.4.2)
|
|
||||||
minitest (>= 5.1)
|
|
||||||
securerandom (>= 0.3)
|
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
|
||||||
uri (>= 0.13.1)
|
|
||||||
base64 (0.3.0)
|
|
||||||
benchmark (0.4.1)
|
|
||||||
bigdecimal (3.2.3)
|
|
||||||
builder (3.3.0)
|
|
||||||
concurrent-ruby (1.3.5)
|
|
||||||
connection_pool (2.5.4)
|
|
||||||
crass (1.0.6)
|
|
||||||
date (3.4.1)
|
|
||||||
debug (1.11.0)
|
|
||||||
irb (~> 1.10)
|
|
||||||
reline (>= 0.3.8)
|
|
||||||
drb (2.2.3)
|
|
||||||
erb (5.0.2)
|
|
||||||
erubi (1.13.1)
|
|
||||||
globalid (1.2.1)
|
|
||||||
activesupport (>= 6.1)
|
|
||||||
i18n (1.14.7)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
io-console (0.8.1)
|
|
||||||
irb (1.15.2)
|
|
||||||
pp (>= 0.6.0)
|
|
||||||
rdoc (>= 4.0.0)
|
|
||||||
reline (>= 0.4.2)
|
|
||||||
logger (1.7.0)
|
|
||||||
loofah (2.24.1)
|
|
||||||
crass (~> 1.0.2)
|
|
||||||
nokogiri (>= 1.12.0)
|
|
||||||
mail (2.8.1)
|
|
||||||
mini_mime (>= 0.1.1)
|
|
||||||
net-imap
|
|
||||||
net-pop
|
|
||||||
net-smtp
|
|
||||||
marcel (1.1.0)
|
|
||||||
mini_mime (1.1.5)
|
|
||||||
minitest (5.25.5)
|
|
||||||
net-imap (0.5.10)
|
|
||||||
date
|
|
||||||
net-protocol
|
|
||||||
net-pop (0.1.2)
|
|
||||||
net-protocol
|
|
||||||
net-protocol (0.2.2)
|
|
||||||
timeout
|
|
||||||
net-smtp (0.5.1)
|
|
||||||
net-protocol
|
|
||||||
nio4r (2.7.4)
|
|
||||||
nokogiri (1.18.10-aarch64-linux-gnu)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-aarch64-linux-musl)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-arm-linux-gnu)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-arm-linux-musl)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-arm64-darwin)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-x86_64-darwin)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-x86_64-linux-gnu)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.18.10-x86_64-linux-musl)
|
|
||||||
racc (~> 1.4)
|
|
||||||
pp (0.6.2)
|
|
||||||
prettyprint
|
|
||||||
prettyprint (0.2.0)
|
|
||||||
propshaft (1.2.1)
|
|
||||||
actionpack (>= 7.0.0)
|
|
||||||
activesupport (>= 7.0.0)
|
|
||||||
rack
|
|
||||||
psych (5.2.6)
|
|
||||||
date
|
|
||||||
stringio
|
|
||||||
puma (7.0.3)
|
|
||||||
nio4r (~> 2.0)
|
|
||||||
racc (1.8.1)
|
|
||||||
rack (3.2.1)
|
|
||||||
rack-session (2.1.1)
|
|
||||||
base64 (>= 0.1.0)
|
|
||||||
rack (>= 3.0.0)
|
|
||||||
rack-test (2.2.0)
|
|
||||||
rack (>= 1.3)
|
|
||||||
rackup (2.2.1)
|
|
||||||
rack (>= 3)
|
|
||||||
rails (8.0.2.1)
|
|
||||||
actioncable (= 8.0.2.1)
|
|
||||||
actionmailbox (= 8.0.2.1)
|
|
||||||
actionmailer (= 8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
actiontext (= 8.0.2.1)
|
|
||||||
actionview (= 8.0.2.1)
|
|
||||||
activejob (= 8.0.2.1)
|
|
||||||
activemodel (= 8.0.2.1)
|
|
||||||
activerecord (= 8.0.2.1)
|
|
||||||
activestorage (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
bundler (>= 1.15.0)
|
|
||||||
railties (= 8.0.2.1)
|
|
||||||
rails-dom-testing (2.3.0)
|
|
||||||
activesupport (>= 5.0.0)
|
|
||||||
minitest
|
|
||||||
nokogiri (>= 1.6)
|
|
||||||
rails-html-sanitizer (1.6.2)
|
|
||||||
loofah (~> 2.21)
|
|
||||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
||||||
railties (8.0.2.1)
|
|
||||||
actionpack (= 8.0.2.1)
|
|
||||||
activesupport (= 8.0.2.1)
|
|
||||||
irb (~> 1.13)
|
|
||||||
rackup (>= 1.0.0)
|
|
||||||
rake (>= 12.2)
|
|
||||||
thor (~> 1.0, >= 1.2.2)
|
|
||||||
zeitwerk (~> 2.6)
|
|
||||||
rake (13.3.0)
|
|
||||||
rdoc (6.14.2)
|
|
||||||
erb
|
|
||||||
psych (>= 4.0.0)
|
|
||||||
reline (0.6.2)
|
|
||||||
io-console (~> 0.5)
|
|
||||||
securerandom (0.4.1)
|
|
||||||
sqlite3 (2.7.4-aarch64-linux-gnu)
|
|
||||||
sqlite3 (2.7.4-aarch64-linux-musl)
|
|
||||||
sqlite3 (2.7.4-arm-linux-gnu)
|
|
||||||
sqlite3 (2.7.4-arm-linux-musl)
|
|
||||||
sqlite3 (2.7.4-arm64-darwin)
|
|
||||||
sqlite3 (2.7.4-x86_64-darwin)
|
|
||||||
sqlite3 (2.7.4-x86_64-linux-gnu)
|
|
||||||
sqlite3 (2.7.4-x86_64-linux-musl)
|
|
||||||
stringio (3.1.7)
|
|
||||||
thor (1.4.0)
|
|
||||||
timeout (0.4.3)
|
|
||||||
tzinfo (2.0.6)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
uri (1.0.3)
|
|
||||||
useragent (0.16.11)
|
|
||||||
view_component (4.0.2)
|
|
||||||
activesupport (>= 7.1.0, < 8.1)
|
|
||||||
concurrent-ruby (~> 1)
|
|
||||||
websocket-driver (0.8.0)
|
|
||||||
base64
|
|
||||||
websocket-extensions (>= 0.1.0)
|
|
||||||
websocket-extensions (0.1.5)
|
|
||||||
zeitwerk (2.7.3)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
aarch64-linux
|
|
||||||
aarch64-linux-gnu
|
|
||||||
aarch64-linux-musl
|
|
||||||
arm-linux-gnu
|
|
||||||
arm-linux-musl
|
|
||||||
arm64-darwin
|
|
||||||
x86_64-darwin
|
|
||||||
x86_64-linux
|
|
||||||
x86_64-linux-gnu
|
|
||||||
x86_64-linux-musl
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
debug
|
|
||||||
propshaft
|
|
||||||
puma (>= 5.0)
|
|
||||||
rails (~> 8.0.2, >= 8.0.2.1)
|
|
||||||
sqlite3 (>= 2.1)
|
|
||||||
tzinfo-data
|
|
||||||
view_component
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
2.7.1
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
<img src="https://git.frzn.dev/RoscoeDaWah/wah.moe/raw/branch/master/.forgejo/assets/logo.svg" alt="" height="100" align="center"/>
|
<img src="https://git.frzn.dev/RoscoeDaWah/wah.moe/raw/branch/master/assets/logo.svg" alt="" height="100" align="center"/>
|
||||||
<hr>
|
<hr>
|
||||||
My personal website, developed using the Rails framework
|
My personal website, developed using the Laravel framework
|
||||||
|
|
|
||||||
6
Rakefile
6
Rakefile
|
|
@ -1,6 +0,0 @@
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
||||||
|
|
||||||
require_relative "config/application"
|
|
||||||
|
|
||||||
Rails.application.load_tasks
|
|
||||||
27
app/Console/Kernel.php
Normal file
27
app/Console/Kernel.php
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the application's command schedule.
|
||||||
|
*/
|
||||||
|
protected function schedule(Schedule $schedule): void
|
||||||
|
{
|
||||||
|
// $schedule->command('inspire')->hourly();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the commands for the application.
|
||||||
|
*/
|
||||||
|
protected function commands(): void
|
||||||
|
{
|
||||||
|
$this->load(__DIR__.'/Commands');
|
||||||
|
|
||||||
|
require base_path('routes/console.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
32
app/Exceptions/Handler.php
Normal file
32
app/Exceptions/Handler.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $dontFlash = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the exception handling callbacks for the application.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->reportable(function (Throwable $e) {
|
||||||
|
if (app()->bound('sentry')) {
|
||||||
|
app('sentry')->captureException($e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/Helpers/LegacyHelper.php
Normal file
15
app/Helpers/LegacyHelper.php
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!function_exists('isLegacy')) {
|
||||||
|
/**
|
||||||
|
* Checks if the current hostname should return the legacy site
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function isLegacy(): bool {
|
||||||
|
return (
|
||||||
|
request()->getHost() === "legacy.wah.moe" || // Accessed via legacy.wah.moe domain
|
||||||
|
str_starts_with(request()->getHost(), "192.168") || // Accessed via local IP address
|
||||||
|
!request()->hasHeader("Host") // Browser does not send Host header (e.g. NCSA MOSAIC)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/Http/Controllers/BookmarksController.php
Normal file
15
app/Http/Controllers/BookmarksController.php
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\BookmarkSite;
|
||||||
|
use App\Models\BookmarkCategory;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class BookmarksController extends Controller
|
||||||
|
{
|
||||||
|
public function show() : View {
|
||||||
|
$categories = BookmarkCategory::with('sites')->get();
|
||||||
|
return view('bookmarks', compact('categories'));
|
||||||
|
}
|
||||||
|
}
|
||||||
12
app/Http/Controllers/Controller.php
Normal file
12
app/Http/Controllers/Controller.php
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests, ValidatesRequests;
|
||||||
|
}
|
||||||
33
app/Http/Controllers/GuestbookController.php
Normal file
33
app/Http/Controllers/GuestbookController.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\GuestbookEntry;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use UAParser\Parser;
|
||||||
|
|
||||||
|
class GuestbookController extends Controller {
|
||||||
|
public function show(): View {
|
||||||
|
$entries = GuestbookEntry::selectEntries();
|
||||||
|
$parser = Parser::create();
|
||||||
|
|
||||||
|
return view('guestbook')
|
||||||
|
->with('entries', $entries)
|
||||||
|
->with('parser', $parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new guestbook entry
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return RedirectResponse
|
||||||
|
* @throws ValidationException
|
||||||
|
*/
|
||||||
|
public function addEntry(Request $request): RedirectResponse {
|
||||||
|
GuestbookEntry::insertGuestbookEntry($request);
|
||||||
|
return back()->with('success', 'Entry submitted successfully!');
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Http/Controllers/HomeController.php
Normal file
33
app/Http/Controllers/HomeController.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
class HomeController extends Controller {
|
||||||
|
/**
|
||||||
|
* Returns age based on birthday date and current date (GMT)
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function returnAge(): int {
|
||||||
|
date_default_timezone_set('Europe/London');
|
||||||
|
$birthday = new DateTime("2005-06-07");
|
||||||
|
$currentDate = DateTime::createFromFormat("Y-m-d", date("Y-m-d"));
|
||||||
|
$age = $birthday->diff($currentDate);
|
||||||
|
return $age->y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows home page
|
||||||
|
* @return View
|
||||||
|
*/
|
||||||
|
public function show(): View {
|
||||||
|
return view('home', [
|
||||||
|
'age' => $this->returnAge(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
76
app/Http/Controllers/MusicController.php
Normal file
76
app/Http/Controllers/MusicController.php
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class MusicController extends Controller
|
||||||
|
{
|
||||||
|
public function getCurrentTrack() {
|
||||||
|
// If it's already cached just return that
|
||||||
|
if (Cache::has('current_track')) {
|
||||||
|
return Cache::get('current_track');
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = Http::withQueryParameters([
|
||||||
|
'method' => 'user.getrecenttracks',
|
||||||
|
'user' => Config::get('services.lastfm.user'),
|
||||||
|
'format' => 'json',
|
||||||
|
'nowplaying' => 'true',
|
||||||
|
'api_key' => Config::get('services.lastfm.key')
|
||||||
|
])->get('https://ws.audioscrobbler.com/2.0/');
|
||||||
|
$data = $response->json();
|
||||||
|
$track_data = $data["recenttracks"]["track"][0];
|
||||||
|
// $image = array_column($track_data["image"], null, 'size')['large'] ?? false;
|
||||||
|
$image = end($track_data["image"]) ?? false;
|
||||||
|
$now_playing = false;
|
||||||
|
if (array_key_exists("@attr", $track_data)) {
|
||||||
|
$now_playing = $track_data["@attr"]["nowplaying"] == "true" ?? ["url"=>null];
|
||||||
|
}
|
||||||
|
$current_track = [
|
||||||
|
'title' => $track_data["name"],
|
||||||
|
'artist' => $track_data["artist"]["#text"],
|
||||||
|
'url' => $track_data["url"],
|
||||||
|
'image' => $image["#text"],
|
||||||
|
'header' => $now_playing ? "Now Playing" : "Last Track",
|
||||||
|
];
|
||||||
|
Cache::put('current_track', $current_track, now()->addSeconds(15));
|
||||||
|
return $current_track;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTopTracks() {
|
||||||
|
// If it's already cached just return that
|
||||||
|
if (Cache::has('top_tracks')) {
|
||||||
|
return Cache::get('top_tracks');
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = Http::withQueryParameters([
|
||||||
|
'method' => 'user.gettoptracks',
|
||||||
|
'user' => Config::get('services.lastfm.user'),
|
||||||
|
'format' => 'json',
|
||||||
|
'period' => '1month',
|
||||||
|
'limit' => 10,
|
||||||
|
'api_key' => Config::get('services.lastfm.key')
|
||||||
|
])->get('https://ws.audioscrobbler.com/2.0/');
|
||||||
|
$data = $response->json();
|
||||||
|
$topTracks = [];
|
||||||
|
foreach ($data["toptracks"]["track"] as $track) {
|
||||||
|
$topTracks[] = [
|
||||||
|
'title' => $track["name"],
|
||||||
|
'artist' => $track["artist"]["name"],
|
||||||
|
'url' => $track["url"],
|
||||||
|
'plays' => $track["playcount"],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
Cache::put('top_tracks', $topTracks, now()->addSeconds(15));
|
||||||
|
return $topTracks;
|
||||||
|
}
|
||||||
|
public function show() : View {
|
||||||
|
return view('music')
|
||||||
|
->with('current_track', $this->getCurrentTrack())
|
||||||
|
->with('top_tracks', $this->getTopTracks());
|
||||||
|
}
|
||||||
|
}
|
||||||
52
app/Http/Controllers/RoscoLekoController.php
Normal file
52
app/Http/Controllers/RoscoLekoController.php
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class RoscoLekoController extends Controller {
|
||||||
|
public function getImages(): array {
|
||||||
|
$images = [];
|
||||||
|
$path = 'images/pandamonium';
|
||||||
|
if (isLegacy()) {
|
||||||
|
$path = 'images/pandamonium-legacy';
|
||||||
|
}
|
||||||
|
foreach (File::glob(public_path($path).'/*') as $path) {
|
||||||
|
$image_data = [];
|
||||||
|
try {
|
||||||
|
$exif = exif_read_data($path);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
$image_data["path"] = str_replace(public_path(), '', $path);
|
||||||
|
if (isset($exif)) {
|
||||||
|
if (isset($exif["ImageDescription"])) {
|
||||||
|
$image_data["description"] = $exif["ImageDescription"];
|
||||||
|
}
|
||||||
|
if (isset($exif["DateTime"])) {
|
||||||
|
$image_data["date"] = strtotime($exif["DateTime"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_push($images, $image_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
usort($images, function ($a, $b) {
|
||||||
|
$dateA = $a['date'] ?? PHP_INT_MIN;
|
||||||
|
$dateB = $b['date'] ?? PHP_INT_MIN;
|
||||||
|
return $dateB <=> $dateA;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $images;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the page
|
||||||
|
* @return View
|
||||||
|
*/
|
||||||
|
public function show(): View {
|
||||||
|
return view('pandamonium', [
|
||||||
|
'images' => $this->getImages(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
73
app/Http/Kernel.php
Normal file
73
app/Http/Kernel.php
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application's global HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* These middleware are run during every request to your application.
|
||||||
|
*
|
||||||
|
* @var array<int, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
// \App\Http\Middleware\TrustHosts::class,
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\Illuminate\Http\Middleware\HandleCors::class,
|
||||||
|
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware groups.
|
||||||
|
*
|
||||||
|
* @var array<string, array<int, class-string|string>>
|
||||||
|
*/
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
|
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $routeMiddleware = [
|
||||||
|
'rate_limit' => \App\Http\Middleware\RateLimiter::class,
|
||||||
|
'validator' => \App\Http\Middleware\GuestbookValidate::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's middleware aliases.
|
||||||
|
*
|
||||||
|
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middlewareAliases = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
|
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||||
|
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||||
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
17
app/Http/Middleware/Authenticate.php
Normal file
17
app/Http/Middleware/Authenticate.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Authenticate extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
|
*/
|
||||||
|
protected function redirectTo(Request $request): ?string
|
||||||
|
{
|
||||||
|
return $request->expectsJson() ? null : route('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||||
|
|
||||||
|
class EncryptCookies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the cookies that should not be encrypted.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
"colorscheme"
|
||||||
|
];
|
||||||
|
}
|
||||||
37
app/Http/Middleware/GuestbookValidate.php
Normal file
37
app/Http/Middleware/GuestbookValidate.php
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class GuestbookValidate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
!$request->validate([
|
||||||
|
'name' => 'required',
|
||||||
|
'message' => 'required'
|
||||||
|
]) ||
|
||||||
|
$this->containsUrl($request->get('message')) ||
|
||||||
|
$this->containsUrl($request->get('name'))
|
||||||
|
) {
|
||||||
|
return response()->view('errors.guestbook-invalid', [], 400);
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function containsUrl($str) {
|
||||||
|
$matches = [];
|
||||||
|
$pattern = '/\b(?:https?|ftp|www)(:\/\/)*[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i';
|
||||||
|
preg_match_all($pattern, $str, $matches);
|
||||||
|
return count($matches[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
15
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||||
|
|
||||||
|
class PreventRequestsDuringMaintenance extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [];
|
||||||
|
}
|
||||||
35
app/Http/Middleware/RateLimiter.php
Normal file
35
app/Http/Middleware/RateLimiter.php
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class RateLimiter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
if (auth()->check()) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
$ipAddress = $request->ip();
|
||||||
|
$cacheKey = 'rate_limit_'.$ipAddress;
|
||||||
|
|
||||||
|
if (Cache::has($cacheKey)) {
|
||||||
|
// If the cache key exists, the IP has submitted an entry within the last hour.
|
||||||
|
return response()->view('errors.guestbook-ratelimit', [], 429);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the IP address to the cache and set the expiration time to one hour.
|
||||||
|
Cache::put($cacheKey, true, 3600);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class RedirectIfAuthenticated
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
|
{
|
||||||
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
|
|
||||||
|
foreach ($guards as $guard) {
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
} // End handle().
|
||||||
|
}
|
||||||
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||||
|
|
||||||
|
class TrimStrings extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the attributes that should not be trimmed.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
}
|
||||||
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
|
class TrustHosts extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the host patterns that should be trusted.
|
||||||
|
*
|
||||||
|
* @return array<int, string|null>
|
||||||
|
*/
|
||||||
|
public function hosts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->allSubdomainsOfApplicationUrl(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/Http/Middleware/TrustProxies.php
Normal file
29
app/Http/Middleware/TrustProxies.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TrustProxies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trusted proxies for this application.
|
||||||
|
*
|
||||||
|
* @var array<int, string>|string|null
|
||||||
|
*/
|
||||||
|
protected $proxies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The headers that should be used to detect proxies.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $headers =(
|
||||||
|
Request::HEADER_X_FORWARDED_FOR |
|
||||||
|
Request::HEADER_X_FORWARDED_HOST |
|
||||||
|
Request::HEADER_X_FORWARDED_PORT |
|
||||||
|
Request::HEADER_X_FORWARDED_PROTO |
|
||||||
|
Request::HEADER_X_FORWARDED_AWS_ELB
|
||||||
|
);
|
||||||
|
}
|
||||||
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||||
|
|
||||||
|
class ValidateSignature extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the query string parameters that should be ignored.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
// 'fbclid',
|
||||||
|
// 'utm_campaign',
|
||||||
|
// 'utm_content',
|
||||||
|
// 'utm_medium',
|
||||||
|
// 'utm_source',
|
||||||
|
// 'utm_term',
|
||||||
|
];
|
||||||
|
}
|
||||||
15
app/Http/Middleware/VerifyCsrfToken.php
Normal file
15
app/Http/Middleware/VerifyCsrfToken.php
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||||
|
|
||||||
|
class VerifyCsrfToken extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be excluded from CSRF verification.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [];
|
||||||
|
}
|
||||||
36
app/Models/BookmarkCategory.php
Normal file
36
app/Models/BookmarkCategory.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BookmarkCategory extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = "bookmark__categories";
|
||||||
|
protected $fillable = ['name'];
|
||||||
|
|
||||||
|
public function sites() {
|
||||||
|
return $this->hasMany(BookmarkSite::class, 'category');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function insertBookmarkCategory(string $name) {
|
||||||
|
$newBookmarkCategory = new BookmarkCategory;
|
||||||
|
$newBookmarkCategory->name = $name;
|
||||||
|
$newBookmarkCategory->save();
|
||||||
|
}
|
||||||
|
public static function selectBookmarks(int $id) {
|
||||||
|
$bookmarks = BookmarkSite::where('category', '=', $id)->firstOrFail();
|
||||||
|
return $bookmarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function importBookmarkCategory(array $data) {
|
||||||
|
foreach ($data as $category) {
|
||||||
|
$newBookmarkCategory = new BookmarkCategory;
|
||||||
|
$newBookmarkCategory->name = $category['name'];
|
||||||
|
$newBookmarkCategory->priority = intval($category['priority']);
|
||||||
|
$newBookmarkCategory->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/Models/BookmarkSite.php
Normal file
35
app/Models/BookmarkSite.php
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BookmarkSite extends Model {
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = "bookmark__sites";
|
||||||
|
protected $fillable = ['name', 'description', 'url', 'category'];
|
||||||
|
|
||||||
|
public function category() {
|
||||||
|
return $this->belongsTo(BookmarkCategory::class, 'category');
|
||||||
|
}
|
||||||
|
public static function insertBookmark(string $name, string $url, int $category) {
|
||||||
|
$category = BookmarkCategory::where('id', $category)->firstOrFail();
|
||||||
|
$newBookmark = new BookmarkSite;
|
||||||
|
$newBookmark->name = $name;
|
||||||
|
$newBookmark->url = $url;
|
||||||
|
$newBookmark->category = $category->id;
|
||||||
|
$newBookmark->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function importBookmark(array $data) {
|
||||||
|
foreach ($data as $site) {
|
||||||
|
$newBookmark = new BookmarkSite;
|
||||||
|
$newBookmark->name = $site['name'];
|
||||||
|
$newBookmark->description = $site['description'];
|
||||||
|
$newBookmark->url = $site['url'];
|
||||||
|
$newBookmark->category = $site['category_id'];
|
||||||
|
$newBookmark->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
app/Models/GuestbookEntry.php
Normal file
50
app/Models/GuestbookEntry.php
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GuestbookEntry extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = "guestbook__entries";
|
||||||
|
protected $fillable = ['name', 'message'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new guestbook entry.
|
||||||
|
*
|
||||||
|
* @param Request $request The HTTP POST request
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function insertGuestbookEntry(Request $request) {
|
||||||
|
$newEntry = new GuestbookEntry;
|
||||||
|
$newEntry->name = $request->get('name');
|
||||||
|
$newEntry->message = $request->get('message');
|
||||||
|
$newEntry->ip = $request->ip();
|
||||||
|
$newEntry->agent = $request->userAgent();
|
||||||
|
$newEntry->legacy_flagged = isLegacy();
|
||||||
|
$newEntry->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function selectEntries() {
|
||||||
|
$entries = GuestbookEntry::where("legacy_flagged", false)->orderBy('created_at', 'desc')->get();
|
||||||
|
return $entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function importGuestbookEntry(array $data) {
|
||||||
|
foreach ($data as $entry) {
|
||||||
|
$dt = new \DateTime('@' . $entry['timestamp']);
|
||||||
|
$newEntry = new GuestbookEntry;
|
||||||
|
$newEntry->name = $entry['name'];
|
||||||
|
$newEntry->ip = $entry['ip_address'];
|
||||||
|
$newEntry->agent = $entry['agent'];
|
||||||
|
$newEntry->admin = $entry['site_owner'];
|
||||||
|
$newEntry->message = $entry['message'];
|
||||||
|
$newEntry->created_at = $dt;
|
||||||
|
$newEntry->updated_at = $dt;
|
||||||
|
$newEntry->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/Providers/AppServiceProvider.php
Normal file
21
app/Providers/AppServiceProvider.php
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use PostHog\PostHog;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider {
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void {}
|
||||||
|
}
|
||||||
25
app/Providers/AuthServiceProvider.php
Normal file
25
app/Providers/AuthServiceProvider.php
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The model to policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, class-string>
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Providers/BroadcastServiceProvider.php
Normal file
19
app/Providers/BroadcastServiceProvider.php
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
Broadcast::routes();
|
||||||
|
|
||||||
|
require base_path('routes/channels.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
38
app/Providers/EventServiceProvider.php
Normal file
38
app/Providers/EventServiceProvider.php
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event to listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<int, class-string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if events and listeners should be automatically discovered.
|
||||||
|
*/
|
||||||
|
public function shouldDiscoverEvents(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/Providers/RouteServiceProvider.php
Normal file
40
app/Providers/RouteServiceProvider.php
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The path to your application's "home" route.
|
||||||
|
*
|
||||||
|
* Typically, users are redirected here after authentication.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const HOME = '/home';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, and other route configuration.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::middleware('api')
|
||||||
|
->prefix('api')
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/View/Components/LastFMCurrent.php
Normal file
24
app/View/Components/LastFMCurrent.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class LastFMCurrent extends Component {
|
||||||
|
public $track;
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct($track) {
|
||||||
|
$this->track = $track;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
return view('components.lastfm-current');
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/View/Components/LastFMTop.php
Normal file
24
app/View/Components/LastFMTop.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class LastFMTop extends Component {
|
||||||
|
public $tracks;
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct($tracks) {
|
||||||
|
$this->tracks = $tracks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
return view('components.lastfm-top');
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/View/Components/LastFMTrack.php
Normal file
26
app/View/Components/LastFMTrack.php
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class LastFMTrack extends Component {
|
||||||
|
public $track;
|
||||||
|
public $count;
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct($track, $count) {
|
||||||
|
$this->track = $track;
|
||||||
|
$this->count = $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
return view('components.lastfm-track');
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/View/Components/Layout.php
Normal file
40
app/View/Components/Layout.php
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use DateTime;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Layout extends Component {
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
if (isLegacy()) {
|
||||||
|
return view('components.layout-legacy', [
|
||||||
|
'isChristmas' => $this->isItChristmas()
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return view('components.layout', [
|
||||||
|
'isChristmas' => $this->isItChristmas()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isItChristmas() : bool {
|
||||||
|
$currentDate = new DateTime();
|
||||||
|
$currentYear = intval($currentDate->format('Y'));
|
||||||
|
|
||||||
|
$startDate = new DateTime("$currentYear-11-10");
|
||||||
|
$endDate = new DateTime(($currentYear + 1) . "-01-01");
|
||||||
|
|
||||||
|
return $currentDate >= $startDate && $currentDate < $endDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/View/Components/Navbar.php
Normal file
24
app/View/Components/Navbar.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Navbar extends Component {
|
||||||
|
public $title;
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct($title) {
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
return view('components.navigation');
|
||||||
|
}
|
||||||
|
}
|
||||||
50
app/View/Components/Wah.php
Normal file
50
app/View/Components/Wah.php
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Wah extends Component {
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct() {}
|
||||||
|
|
||||||
|
|
||||||
|
public function getWah(): string {
|
||||||
|
if (isLegacy()) {
|
||||||
|
try {
|
||||||
|
$response = Http::get('https://api.tinyfox.dev/img.json?animal=wah');
|
||||||
|
$data = $response->json();
|
||||||
|
if ($data == null) return "";
|
||||||
|
$path = parse_url("https://api.tinyfox.dev" . $data["loc"], PHP_URL_PATH);
|
||||||
|
return "//".request()->getHttpHost()."/proxy/wah/".basename($path);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$response = Http::get('https://api.tinyfox.dev/img.json?animal=wah');
|
||||||
|
$data = $response->json();
|
||||||
|
if ($data == null) return "";
|
||||||
|
return "https://api.tinyfox.dev" . $data["loc"];
|
||||||
|
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|Closure|string {
|
||||||
|
return view('components.wah', [
|
||||||
|
'wah' => $this->getWah(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<div class="wah">
|
|
||||||
<h3>Random Wah!</h3>
|
|
||||||
<%= image_tag @wah_url, alt: "Random image featuring a red panda" %>
|
|
||||||
<p>Image "stolen" from <a href="https://tinyfox.dev/">tinyfox.dev</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
require "net/http"
|
|
||||||
require "json"
|
|
||||||
|
|
||||||
class WahComponent < ViewComponent::Base
|
|
||||||
def initialize(legacy:)
|
|
||||||
if legacy then
|
|
||||||
else
|
|
||||||
uri = URI.parse('https://api.tinyfox.dev/img.json?animal=wah')
|
|
||||||
req = Net::HTTP::Get.new(uri.to_s)
|
|
||||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http|
|
|
||||||
http.request(req)
|
|
||||||
}
|
|
||||||
data = JSON.parse(res.body)
|
|
||||||
url = "https://tinyfox.dev" + data["loc"]
|
|
||||||
|
|
||||||
@wah_url = url
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
class ApplicationController < ActionController::Base
|
|
||||||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
|
||||||
allow_browser versions: :modern
|
|
||||||
end
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
class HomeController < ApplicationController
|
|
||||||
def years_between_dates(date_from, date_to)
|
|
||||||
return (date_to - date_from).to_i / 365
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
@age = years_between_dates(DateTime.civil_from_format(:local, 2005, 6, 7), DateTime.now)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
require 'uri'
|
|
||||||
require 'net/http'
|
|
||||||
|
|
||||||
class MusicController < ApplicationController
|
|
||||||
def get_current_track
|
|
||||||
if Rails.cache.exist?("current_track")
|
|
||||||
return Rails.cache.read("current_track")
|
|
||||||
end
|
|
||||||
|
|
||||||
uri = URI.parse('https://ws.audioscrobbler.com/2.0/')
|
|
||||||
params = {
|
|
||||||
:method => 'user.getrecenttracks',
|
|
||||||
:user => Rails.application.credentials.lastfm.username,
|
|
||||||
:format => 'json',
|
|
||||||
:nowplaying => 'true',
|
|
||||||
:api_key => Rails.application.credentials.lastfm.api_key
|
|
||||||
}
|
|
||||||
uri.query = URI.encode_www_form(params)
|
|
||||||
req = Net::HTTP::Get.new(uri.to_s)
|
|
||||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http|
|
|
||||||
http.request(req)
|
|
||||||
}
|
|
||||||
data = JSON.parse(res.body)
|
|
||||||
track_data = data["recenttracks"]["track"][0]
|
|
||||||
image = defined?(track_data["image"][-1]) ? track_data["image"][-1] : false
|
|
||||||
now_playing = false
|
|
||||||
if track_data["@attr"] != nil
|
|
||||||
now_playing = track_data["@attr"]["nowplaying"] == "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
current_track = {
|
|
||||||
:title => track_data["name"],
|
|
||||||
:artist => track_data["artist"]["#text"],
|
|
||||||
:url => track_data["url"],
|
|
||||||
:image => image["#text"],
|
|
||||||
:header => if now_playing then "Now Playing" else "Last Track" end
|
|
||||||
}
|
|
||||||
return current_track
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_top_tracks
|
|
||||||
if Rails.cache.exist?("top_tracks")
|
|
||||||
return Rails.cache.read("top_tracks")
|
|
||||||
end
|
|
||||||
|
|
||||||
uri = URI.parse('https://ws.audioscrobbler.com/2.0/')
|
|
||||||
params = {
|
|
||||||
:method => 'user.gettoptracks',
|
|
||||||
:user => Rails.application.credentials.lastfm.username,
|
|
||||||
:format => 'json',
|
|
||||||
:period => '1month',
|
|
||||||
:limit => 10,
|
|
||||||
:api_key => Rails.application.credentials.lastfm.api_key
|
|
||||||
}
|
|
||||||
uri.query = URI.encode_www_form(params)
|
|
||||||
req = Net::HTTP::Get.new(uri.to_s)
|
|
||||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http|
|
|
||||||
http.request(req)
|
|
||||||
}
|
|
||||||
data = JSON.parse(res.body)
|
|
||||||
top_tracks = []
|
|
||||||
data["toptracks"]["track"].each do |track|
|
|
||||||
top_tracks.push({
|
|
||||||
:title => track["name"],
|
|
||||||
:artist => track["artist"]["name"],
|
|
||||||
:url => track["url"],
|
|
||||||
:plays => track["playcount"]
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return top_tracks
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
@current_track = get_current_track
|
|
||||||
@top_tracks = get_top_tracks
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
module ApplicationHelper
|
|
||||||
def is_legacy
|
|
||||||
return (
|
|
||||||
request.host === "legacy.wah.moe" or
|
|
||||||
request.host.start_with? ("192.168") or
|
|
||||||
request.headers["Host"] === nil
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
module HomeHelper
|
|
||||||
end
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
module MusicHelper
|
|
||||||
end
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
class ApplicationRecord < ActiveRecord::Base
|
|
||||||
primary_abstract_class
|
|
||||||
end
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
<%= unless is_legacy then render(WahComponent.new(legacy: is_legacy)) end %>
|
|
||||||
|
|
||||||
<p>Hi! This is my personal homepage on the <strong>W</strong>orld <strong>W</strong>ide
|
|
||||||
<strong>W</strong>eb.
|
|
||||||
</p>
|
|
||||||
<% unless is_legacy then%>
|
|
||||||
<br>
|
|
||||||
<% end %>
|
|
||||||
<p>Some quick facts about me:</p>
|
|
||||||
<ul>
|
|
||||||
<li><%= @age %> y/o, he/him, British</li>
|
|
||||||
<li>Theatre Technician and "Web Developer"</li>
|
|
||||||
<li>Loves ETC desks, prefers Generics to LEDs for some reason</li>
|
|
||||||
<li>Spends way too much time on his computer</li>
|
|
||||||
<li>Favorite games: <a href="https://steamcommunity.com/id/RoscoeDaWah/recommended/420530/"><font color="#000000">OneShot</font></a>,
|
|
||||||
Minecraft, Stardew Valley, N++ and Starbound</li>
|
|
||||||
<li><a href="http://wxqa.com/"><font color="#000000">CWOP</font></a> member</li>
|
|
||||||
</ul>
|
|
||||||
<% unless is_legacy then%>
|
|
||||||
<br>
|
|
||||||
<% end %>
|
|
||||||
<p>Interests:</p>
|
|
||||||
<ul>
|
|
||||||
<li><strong>Tech Theatre</strong> - Lighting, Stage Management, etc.</li>
|
|
||||||
<li><strong>Programming</strong> - HTML, CSS, JavaScript, C#, Java, PHP, Ruby, Python (<a
|
|
||||||
href="https://github.com/RoscoeDaWah"><font color="#000000">GitHub</font></a>)</li>
|
|
||||||
<li><strong>Photography</strong> - <a href="https://www.flickr.com/photos/roscoedawah/"><font color="#000000">Flickr</font></a></li>
|
|
||||||
<li><strong>Gaming</strong> - <a href="https://steamcommunity.com/id/RoscoeDaWah/"><font color="#000000">Steam Profile</font></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<!-- Global -->
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta name="theme-color" content="#f27405">
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<title>wah! (dot moe)</title>
|
|
||||||
<%= csrf_meta_tags %>
|
|
||||||
<%= csp_meta_tag %>
|
|
||||||
|
|
||||||
<%= yield :head %>
|
|
||||||
|
|
||||||
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
||||||
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
||||||
|
|
||||||
<%= favicon_link_tag %>
|
|
||||||
|
|
||||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
|
||||||
<%= stylesheet_link_tag :app %>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<%= link_to (image_tag "progress.svg", width: 120, height: 120, alt: "progressive pride flag"), "https://git.arimelody.me/ari/prideflag", id: "prideflag", target: "_blank" %>
|
|
||||||
<div class="page-container">
|
|
||||||
<div id="header">
|
|
||||||
<header>
|
|
||||||
<div>
|
|
||||||
<%= image_tag "logo-v2.png", class: "logo_paw", width: 65, alt: "A pixel art depiction of a paw, in three alternating shades of blue."%>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h1>wah!</h1>
|
|
||||||
<p>
|
|
||||||
(dot moe)
|
|
||||||
</p>
|
|
||||||
<nav>
|
|
||||||
<strong>Pages:</strong>
|
|
||||||
<a href="/">home</a> |
|
|
||||||
<% unless is_legacy then%>
|
|
||||||
<a href="//wiki.wah.moe">wah-ki</a> |
|
|
||||||
<% end %>
|
|
||||||
<a href="//git.wah.moe">git</a> |
|
|
||||||
<a href="/pub">files</a> |
|
|
||||||
<a href="gopher://wah.moe">gopher</a> |
|
|
||||||
<a href="/bookmarks">bookmarks</a> |
|
|
||||||
<a href="/guestbook">guestbook</a> |
|
|
||||||
<a href="/music">music</a> |
|
|
||||||
<a href="/pandamonium">pandamonium</a>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
</div>
|
|
||||||
<div id="content">
|
|
||||||
<main>
|
|
||||||
<%= yield %>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<footer>
|
|
||||||
<div id="footer">
|
|
||||||
<div>
|
|
||||||
<span>
|
|
||||||
© RoscoeDaWah 2021-<%= Time.now.year %><br>
|
|
||||||
vVERSION, <a href="https://git.frzn.dev/RoscoeDaWah/wah.moe/releases/latest">Source</a><br>
|
|
||||||
<a href="https://webring.julimiro.eu/api/previous/wah.moe"><</a> <a href="https://webring.julimiro.eu/">the basename ring</a> <a href="https://webring.julimiro.eu/api/next/wah.moe">></a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<%= image_tag "buttons/wah.png", alt: "wah! (dot moe)" %>
|
|
||||||
<%= link_to (image_tag "buttons/cnfunknown.gif", alt: "ConfusionUnknown"), "https://aliceisvery.gay" %>
|
|
||||||
<%= link_to (image_tag "buttons/juli.gif", alt: "Julimiro.eu"), "https://julimiro.eu" %>
|
|
||||||
<%= link_to (image_tag "buttons/x86.gif", alt: "x86Overflow"), "https://x86.isafox.gay" %>
|
|
||||||
<%= link_to (image_tag "buttons/thnlqd.png", alt: "thinliquid"), "https://thinliquid.dev" %>
|
|
||||||
<%= link_to (image_tag "https://dimden.dev/services/images/88x31.gif", alt: "Dimden's website"), "https://dimden.dev" %><br>
|
|
||||||
<%= image_tag "buttons/servfail.png", alt: "Servfail DNS" %>
|
|
||||||
<%= link_to (image_tag "buttons/linuxnow.gif", alt: "Linux NOW!"), "https://linux.org" %>
|
|
||||||
<%= image_tag "buttons/paws-aliased.png", alt: "Made with my own two paws" %>
|
|
||||||
<%= image_tag "buttons/transrights.gif", alt: "Trans Rights NOW!" %>
|
|
||||||
<%= link_to (image_tag "buttons/vim.gif", alt: "Vim"), "https://www.vim.org" %>
|
|
||||||
<%= image_tag "buttons/aliasing.png", alt: "I Heart Aliasing" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
<div class="current-track">
|
|
||||||
<% if @current_track["image"] != "" %>
|
|
||||||
<div>
|
|
||||||
<%= image_tag @current_track[:image], alt: "Album cover for " + @current_track[:title] + " by " + @current_track[:artist] %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<div>
|
|
||||||
<h2><%= @current_track[:header]%>:</h2>
|
|
||||||
<font color="#000000"><%== link_to @current_track[:title] %></font><br>
|
|
||||||
by <%= @current_track[:artist] %><br>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="music-top10">
|
|
||||||
<caption>
|
|
||||||
<h2 style="margin-bottom: 5px">Top 10 Tracks (Last 30 days):</h2>
|
|
||||||
</caption>
|
|
||||||
<tr>
|
|
||||||
<th><b>#</b></th>
|
|
||||||
<th><b>Track</b></th>
|
|
||||||
<th><b>Artist</b></th>
|
|
||||||
<th><b>Plays</b></th>
|
|
||||||
</tr>
|
|
||||||
<% @top_tracks.each.with_index do |track, index| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= index %></td>
|
|
||||||
<td><font color="#000000"><%= link_to track[:title], track[:url] %></font></td>
|
|
||||||
<td><%= track[:artist] %></td>
|
|
||||||
<td><%= track[:plays] %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "WahMoe",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "/icon.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "512x512"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "/icon.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"purpose": "maskable"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": "/",
|
|
||||||
"display": "standalone",
|
|
||||||
"scope": "/",
|
|
||||||
"description": "WahMoe.",
|
|
||||||
"theme_color": "red",
|
|
||||||
"background_color": "red"
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// Add a service worker for processing Web Push notifications:
|
|
||||||
//
|
|
||||||
// self.addEventListener("push", async (event) => {
|
|
||||||
// const { title, options } = await event.data.json()
|
|
||||||
// event.waitUntil(self.registration.showNotification(title, options))
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// self.addEventListener("notificationclick", function(event) {
|
|
||||||
// event.notification.close()
|
|
||||||
// event.waitUntil(
|
|
||||||
// clients.matchAll({ type: "window" }).then((clientList) => {
|
|
||||||
// for (let i = 0; i < clientList.length; i++) {
|
|
||||||
// let client = clientList[i]
|
|
||||||
// let clientPath = (new URL(client.url)).pathname
|
|
||||||
//
|
|
||||||
// if (clientPath == event.notification.data.path && "focus" in client) {
|
|
||||||
// return client.focus()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (clients.openWindow) {
|
|
||||||
// return clients.openWindow(event.notification.data.path)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// )
|
|
||||||
// })
|
|
||||||
53
artisan
Executable file
53
artisan
Executable file
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register The Auto Loader
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Composer provides a convenient, automatically generated class loader
|
||||||
|
| for our application. We just need to utilize it! We'll require it
|
||||||
|
| into the script here so that we do not have to worry about the
|
||||||
|
| loading of any of our classes manually. It's great to relax.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Run The Artisan Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When we run the console application, the current CLI command will be
|
||||||
|
| executed in this console and the response sent back to a terminal
|
||||||
|
| or another output device for the developers. Here goes nothing!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
|
|
||||||
|
$status = $kernel->handle(
|
||||||
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||||
|
new Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Shutdown The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Once Artisan has finished running, we will fire off the shutdown events
|
||||||
|
| so that any final work may be done by the application before we shut
|
||||||
|
| down the process. This is the last thing to happen to the request.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel->terminate($input, $status);
|
||||||
|
|
||||||
|
exit($status);
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
2
bin/dev
2
bin/dev
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
exec "./bin/rails", "server", *ARGV
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
|
||||||
require_relative "../config/boot"
|
|
||||||
require "rails/commands"
|
|
||||||
4
bin/rake
4
bin/rake
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require_relative "../config/boot"
|
|
||||||
require "rake"
|
|
||||||
Rake.application.run
|
|
||||||
34
bin/setup
34
bin/setup
|
|
@ -1,34 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require "fileutils"
|
|
||||||
|
|
||||||
APP_ROOT = File.expand_path("..", __dir__)
|
|
||||||
|
|
||||||
def system!(*args)
|
|
||||||
system(*args, exception: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.chdir APP_ROOT do
|
|
||||||
# This script is a way to set up or update your development environment automatically.
|
|
||||||
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
|
||||||
# Add necessary setup steps to this file.
|
|
||||||
|
|
||||||
puts "== Installing dependencies =="
|
|
||||||
system("bundle check") || system!("bundle install")
|
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
|
||||||
# unless File.exist?("config/database.yml")
|
|
||||||
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
|
||||||
# end
|
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
|
||||||
system! "bin/rails db:prepare"
|
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
|
||||||
system! "bin/rails log:clear tmp:clear"
|
|
||||||
|
|
||||||
unless ARGV.include?("--skip-server")
|
|
||||||
puts "\n== Starting development server =="
|
|
||||||
STDOUT.flush # flush the output before exec(2) so that it displays
|
|
||||||
exec "bin/dev"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
55
bootstrap/app.php
Normal file
55
bootstrap/app.php
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bind Important Interfaces
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, we need to bind some important interfaces into the container so
|
||||||
|
| we will be able to resolve them when needed. The kernels serve the
|
||||||
|
| incoming requests to this application from both the web and CLI.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Http\Kernel::class,
|
||||||
|
App\Http\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Console\Kernel::class,
|
||||||
|
App\Console\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||||
|
App\Exceptions\Handler::class
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Return The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
||||||
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
||||||
72
composer.json
Normal file
72
composer.json
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"name": "roscoedawah/wah.moe",
|
||||||
|
"type": "project",
|
||||||
|
"description": "My personal website, developed using the Laravel framework.",
|
||||||
|
"keywords": ["laravel", "framework"],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1",
|
||||||
|
"ext-exif": "*",
|
||||||
|
"browner12/helpers": "^3.7",
|
||||||
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
|
"intervention/image": "^3.9",
|
||||||
|
"laravel/framework": "^10.10",
|
||||||
|
"laravel/tinker": "^2.8",
|
||||||
|
"scrivo/highlight.php": "v9.18.1.10",
|
||||||
|
"spatie/laravel-honeypot": "^4.3",
|
||||||
|
"spatie/laravel-html": "^3.4",
|
||||||
|
"ua-parser/uap-php": "^3.9.14"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
"laravel/pint": "^1.0",
|
||||||
|
"laravel/sail": "^1.18",
|
||||||
|
"mockery/mockery": "^1.4.4",
|
||||||
|
"nunomaduro/collision": "^7.0",
|
||||||
|
"phpunit/phpunit": "^10.1",
|
||||||
|
"spatie/laravel-ignition": "^2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"php-http/discovery": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
||||||
8803
composer.lock
generated
Normal file
8803
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +0,0 @@
|
||||||
# This file is used by Rack-based servers to start the application.
|
|
||||||
|
|
||||||
require_relative "config/environment"
|
|
||||||
|
|
||||||
run Rails.application
|
|
||||||
Rails.application.load_server
|
|
||||||
32
config/app.php
Normal file
32
config/app.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => env('APP_NAME', 'wah.moe'),
|
||||||
|
'version' => '2025.08.30-patch2',
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
'asset_url' => env('ASSET_URL'),
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'locale' => 'en',
|
||||||
|
'fallback_locale' => 'en',
|
||||||
|
'faker_locale' => 'en_US',
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
],
|
||||||
|
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
App\Providers\EventServiceProvider::class,
|
||||||
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
browner12\helpers\HelperServiceProvider::class
|
||||||
|
])->toArray(),
|
||||||
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
|
])->toArray(),
|
||||||
|
];
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
require_relative "boot"
|
|
||||||
|
|
||||||
require "rails"
|
|
||||||
# Pick the frameworks you want:
|
|
||||||
require "active_model/railtie"
|
|
||||||
# require "active_job/railtie"
|
|
||||||
require "active_record/railtie"
|
|
||||||
# require "active_storage/engine"
|
|
||||||
require "action_controller/railtie"
|
|
||||||
# require "action_mailer/railtie"
|
|
||||||
# require "action_mailbox/engine"
|
|
||||||
# require "action_text/engine"
|
|
||||||
require "action_view/railtie"
|
|
||||||
# require "action_cable/engine"
|
|
||||||
require "rails/test_unit/railtie"
|
|
||||||
|
|
||||||
require 'view_component'
|
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
|
||||||
# you've limited to :test, :development, or :production.
|
|
||||||
Bundler.require(*Rails.groups)
|
|
||||||
|
|
||||||
module WahMoe
|
|
||||||
class Application < Rails::Application
|
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
|
||||||
config.load_defaults 8.0
|
|
||||||
|
|
||||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
||||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
||||||
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
||||||
config.autoload_lib(ignore: %w[assets tasks])
|
|
||||||
|
|
||||||
# Configuration for the application, engines, and railties goes here.
|
|
||||||
#
|
|
||||||
# These settings can be overridden in specific environments using the files
|
|
||||||
# in config/environments, which are processed later.
|
|
||||||
#
|
|
||||||
# config.time_zone = "Central Time (US & Canada)"
|
|
||||||
# config.eager_load_paths << Rails.root.join("extras")
|
|
||||||
|
|
||||||
# Don't generate system test files.
|
|
||||||
config.generators.system_tests = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
115
config/auth.php
Normal file
115
config/auth.php
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default authentication "guard" and password
|
||||||
|
| reset options for your application. You may change these defaults
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
'passwords' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| here which uses session storage and the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| Supported: "session"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| User Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| If you have multiple user tables or models you may configure multiple
|
||||||
|
| sources which represent each model / table. These sources may then
|
||||||
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
||||||
|
| Supported: "database", "eloquent"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => App\Models\User::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Resetting Passwords
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may specify multiple password reset configurations if you have more
|
||||||
|
| than one user table or model in the application and you want to have
|
||||||
|
| separate password reset settings based on the specific user types.
|
||||||
|
|
|
||||||
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => 'password_reset_tokens',
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Confirmation Timeout
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define the amount of seconds before a password confirmation
|
||||||
|
| times out and the user is prompted to re-enter their password via the
|
||||||
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => 10800,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
||||||
|
|
||||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
|
||||||
44
config/broadcasting.php
Normal file
44
config/broadcasting.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||||
|
'connections' => [
|
||||||
|
'pusher' => [
|
||||||
|
'driver' => 'pusher',
|
||||||
|
'key' => env('PUSHER_APP_KEY'),
|
||||||
|
'secret' => env('PUSHER_APP_SECRET'),
|
||||||
|
'app_id' => env('PUSHER_APP_ID'),
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||||
|
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||||
|
'port' => env('PUSHER_PORT', 443),
|
||||||
|
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||||
|
'encrypted' => true,
|
||||||
|
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||||
|
],
|
||||||
|
'client_options' => [
|
||||||
|
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'ably' => [
|
||||||
|
'driver' => 'ably',
|
||||||
|
'key' => env('ABLY_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'driver' => 'log',
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'null',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
111
config/cache.php
Normal file
111
config/cache.php
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache connection that gets used while
|
||||||
|
| using this caching library. This connection is used when another is
|
||||||
|
| not explicitly specified when executing a given caching function.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('CACHE_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "apc", "array", "database", "file",
|
||||||
|
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'apc' => [
|
||||||
|
'driver' => 'apc',
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'cache',
|
||||||
|
'connection' => null,
|
||||||
|
'lock_connection' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
|
'servers' => [
|
||||||
|
[
|
||||||
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'cache',
|
||||||
|
'lock_connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||||
|
| stores there might be other applications using the same cache. For
|
||||||
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||||
|
|
||||||
|
];
|
||||||
34
config/cors.php
Normal file
34
config/cors.php
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure your settings for cross-origin resource sharing
|
||||||
|
| or "CORS". This determines what cross-origin operations may execute
|
||||||
|
| in web browsers. You are free to adjust these settings as needed.
|
||||||
|
|
|
||||||
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||||
|
|
||||||
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins_patterns' => [],
|
||||||
|
|
||||||
|
'allowed_headers' => ['*'],
|
||||||
|
|
||||||
|
'exposed_headers' => [],
|
||||||
|
|
||||||
|
'max_age' => 0,
|
||||||
|
|
||||||
|
'supports_credentials' => false,
|
||||||
|
|
||||||
|
];
|
||||||
31
config/database.php
Normal file
31
config/database.php
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'migrations' => 'migrations',
|
||||||
|
];
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
# SQLite. Versions 3.8.0 and up are supported.
|
|
||||||
# gem install sqlite3
|
|
||||||
#
|
|
||||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
||||||
# gem "sqlite3"
|
|
||||||
#
|
|
||||||
default: &default
|
|
||||||
adapter: sqlite3
|
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
||||||
timeout: 5000
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
database: storage/development.sqlite3
|
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
|
||||||
# re-generated from your development database when you run "rake".
|
|
||||||
# Do not set this db to the same as development or production.
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
||||||
database: storage/test.sqlite3
|
|
||||||
|
|
||||||
|
|
||||||
# SQLite3 write its data on the local filesystem, as such it requires
|
|
||||||
# persistent disks. If you are deploying to a managed service, you should
|
|
||||||
# make sure it provides disk persistence, as many don't.
|
|
||||||
#
|
|
||||||
# Similarly, if you deploy your application as a Docker container, you must
|
|
||||||
# ensure the database is located in a persisted volume.
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
||||||
# database: path/to/persistent/storage/production.sqlite3
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# Load the Rails application.
|
|
||||||
require_relative "application"
|
|
||||||
|
|
||||||
# Initialize the Rails application.
|
|
||||||
Rails.application.initialize!
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
require "active_support/core_ext/integer/time"
|
|
||||||
|
|
||||||
Rails.application.configure do
|
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
|
||||||
|
|
||||||
# Make code changes take effect immediately without server restart.
|
|
||||||
config.enable_reloading = true
|
|
||||||
|
|
||||||
# Do not eager load code on boot.
|
|
||||||
config.eager_load = false
|
|
||||||
|
|
||||||
# Show full error reports.
|
|
||||||
config.consider_all_requests_local = true
|
|
||||||
|
|
||||||
# Enable server timing.
|
|
||||||
config.server_timing = true
|
|
||||||
|
|
||||||
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
|
||||||
# Run rails dev:cache to toggle Action Controller caching.
|
|
||||||
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
||||||
config.action_controller.perform_caching = true
|
|
||||||
config.action_controller.enable_fragment_cache_logging = true
|
|
||||||
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
|
||||||
else
|
|
||||||
config.action_controller.perform_caching = false
|
|
||||||
end
|
|
||||||
|
|
||||||
# Change to :null_store to avoid any caching.
|
|
||||||
config.cache_store = :memory_store
|
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
|
||||||
config.active_support.deprecation = :log
|
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations.
|
|
||||||
config.active_record.migration_error = :page_load
|
|
||||||
|
|
||||||
# Highlight code that triggered database queries in logs.
|
|
||||||
config.active_record.verbose_query_logs = true
|
|
||||||
|
|
||||||
# Append comments with runtime information tags to SQL queries in logs.
|
|
||||||
config.active_record.query_log_tags_enabled = true
|
|
||||||
|
|
||||||
# Raises error for missing translations.
|
|
||||||
# config.i18n.raise_on_missing_translations = true
|
|
||||||
|
|
||||||
# Annotate rendered view with file names.
|
|
||||||
config.action_view.annotate_rendered_view_with_filenames = true
|
|
||||||
|
|
||||||
# Raise error when a before_action's only/except options reference missing actions.
|
|
||||||
config.action_controller.raise_on_missing_callback_actions = true
|
|
||||||
end
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
require "active_support/core_ext/integer/time"
|
|
||||||
|
|
||||||
Rails.application.configure do
|
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
|
||||||
config.enable_reloading = false
|
|
||||||
|
|
||||||
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
|
||||||
config.eager_load = true
|
|
||||||
|
|
||||||
# Full error reports are disabled.
|
|
||||||
config.consider_all_requests_local = false
|
|
||||||
|
|
||||||
# Turn on fragment caching in view templates.
|
|
||||||
config.action_controller.perform_caching = true
|
|
||||||
|
|
||||||
# Cache assets for far-future expiry since they are all digest stamped.
|
|
||||||
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
||||||
# config.asset_host = "http://assets.example.com"
|
|
||||||
|
|
||||||
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
||||||
config.assume_ssl = true
|
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
||||||
config.force_ssl = true
|
|
||||||
|
|
||||||
# Skip http-to-https redirect for the default health check endpoint.
|
|
||||||
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
|
||||||
|
|
||||||
# Log to STDOUT with the current request id as a default log tag.
|
|
||||||
config.log_tags = [ :request_id ]
|
|
||||||
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
|
||||||
|
|
||||||
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
|
||||||
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
||||||
|
|
||||||
# Prevent health checks from clogging up the logs.
|
|
||||||
config.silence_healthcheck_path = "/up"
|
|
||||||
|
|
||||||
# Don't log any deprecations.
|
|
||||||
config.active_support.report_deprecations = false
|
|
||||||
|
|
||||||
# Replace the default in-process memory cache store with a durable alternative.
|
|
||||||
# config.cache_store = :mem_cache_store
|
|
||||||
|
|
||||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
||||||
# the I18n.default_locale when a translation cannot be found).
|
|
||||||
config.i18n.fallbacks = true
|
|
||||||
|
|
||||||
# Do not dump schema after migrations.
|
|
||||||
config.active_record.dump_schema_after_migration = false
|
|
||||||
|
|
||||||
# Only use :id for inspections in production.
|
|
||||||
config.active_record.attributes_for_inspect = [ :id ]
|
|
||||||
|
|
||||||
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
||||||
# config.hosts = [
|
|
||||||
# "example.com", # Allow requests from example.com
|
|
||||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
||||||
# ]
|
|
||||||
#
|
|
||||||
# Skip DNS rebinding protection for the default health check endpoint.
|
|
||||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
||||||
end
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
# The test environment is used exclusively to run your application's
|
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
|
||||||
# and recreated between test runs. Don't rely on the data there!
|
|
||||||
|
|
||||||
Rails.application.configure do
|
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
|
||||||
|
|
||||||
# While tests run files are not watched, reloading is not necessary.
|
|
||||||
config.enable_reloading = false
|
|
||||||
|
|
||||||
# Eager loading loads your entire application. When running a single test locally,
|
|
||||||
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
||||||
# recommended that you enable it in continuous integration systems to ensure eager
|
|
||||||
# loading is working properly before deploying your code.
|
|
||||||
config.eager_load = ENV["CI"].present?
|
|
||||||
|
|
||||||
# Configure public file server for tests with cache-control for performance.
|
|
||||||
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
|
||||||
|
|
||||||
# Show full error reports.
|
|
||||||
config.consider_all_requests_local = true
|
|
||||||
config.cache_store = :null_store
|
|
||||||
|
|
||||||
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
||||||
config.action_dispatch.show_exceptions = :rescuable
|
|
||||||
|
|
||||||
# Disable request forgery protection in test environment.
|
|
||||||
config.action_controller.allow_forgery_protection = false
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
|
||||||
config.active_support.deprecation = :stderr
|
|
||||||
|
|
||||||
# Raises error for missing translations.
|
|
||||||
# config.i18n.raise_on_missing_translations = true
|
|
||||||
|
|
||||||
# Annotate rendered view with file names.
|
|
||||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
||||||
|
|
||||||
# Raise error when a before_action's only/except options reference missing actions.
|
|
||||||
config.action_controller.raise_on_missing_callback_actions = true
|
|
||||||
end
|
|
||||||
76
config/filesystems.php
Normal file
76
config/filesystems.php
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application. Just store away!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filesystem Disks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||||
|
| may even configure multiple disks of the same driver. Defaults have
|
||||||
|
| been set up for each driver as an example of the required values.
|
||||||
|
|
|
||||||
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disks' => [
|
||||||
|
|
||||||
|
'local' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app'),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'public' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public'),
|
||||||
|
'url' => env('APP_URL').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
's3' => [
|
||||||
|
'driver' => 's3',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
|
'bucket' => env('AWS_BUCKET'),
|
||||||
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
17
config/hashing.php
Normal file
17
config/hashing.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
// One of "bcrypt", "argon", "argon2id"
|
||||||
|
'driver' => 'bcrypt',
|
||||||
|
|
||||||
|
'bcrypt' => [
|
||||||
|
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
'argon' => [
|
||||||
|
'memory' => 65536,
|
||||||
|
'threads' => 1,
|
||||||
|
'time' => 4,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
|
||||||
Rails.application.config.assets.version = "1.0"
|
|
||||||
|
|
||||||
# Add additional assets to the asset load path.
|
|
||||||
# Rails.application.config.assets.paths << Emoji.images_path
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Define an application-wide content security policy.
|
|
||||||
# See the Securing Rails Applications Guide for more information:
|
|
||||||
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
|
||||||
|
|
||||||
# Rails.application.configure do
|
|
||||||
# config.content_security_policy do |policy|
|
|
||||||
# policy.default_src :self, :https
|
|
||||||
# policy.font_src :self, :https, :data
|
|
||||||
# policy.img_src :self, :https, :data
|
|
||||||
# policy.object_src :none
|
|
||||||
# policy.script_src :self, :https
|
|
||||||
# policy.style_src :self, :https
|
|
||||||
# # Specify URI for violation reports
|
|
||||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
||||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
||||||
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
||||||
#
|
|
||||||
# # Report violations without enforcing the policy.
|
|
||||||
# # config.content_security_policy_report_only = true
|
|
||||||
# end
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
|
||||||
# Use this to limit dissemination of sensitive information.
|
|
||||||
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
|
||||||
Rails.application.config.filter_parameters += [
|
|
||||||
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
|
||||||
]
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Add new inflection rules using the following format. Inflections
|
|
||||||
# are locale specific, and you may define rules for as many different
|
|
||||||
# locales as you wish. All of these examples are active by default:
|
|
||||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
||||||
# inflect.plural /^(ox)$/i, "\\1en"
|
|
||||||
# inflect.singular /^(ox)en/i, "\\1"
|
|
||||||
# inflect.irregular "person", "people"
|
|
||||||
# inflect.uncountable %w( fish sheep )
|
|
||||||
# end
|
|
||||||
|
|
||||||
# These inflection rules are supported but not enabled by default:
|
|
||||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
||||||
# inflect.acronym "RESTful"
|
|
||||||
# end
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
# Files in the config/locales directory are used for internationalization and
|
|
||||||
# are automatically loaded by Rails. If you want to use locales other than
|
|
||||||
# English, add the necessary files in this directory.
|
|
||||||
#
|
|
||||||
# To use the locales, use `I18n.t`:
|
|
||||||
#
|
|
||||||
# I18n.t "hello"
|
|
||||||
#
|
|
||||||
# In views, this is aliased to just `t`:
|
|
||||||
#
|
|
||||||
# <%= t("hello") %>
|
|
||||||
#
|
|
||||||
# To use a different locale, set it with `I18n.locale`:
|
|
||||||
#
|
|
||||||
# I18n.locale = :es
|
|
||||||
#
|
|
||||||
# This would use the information in config/locales/es.yml.
|
|
||||||
#
|
|
||||||
# To learn more about the API, please read the Rails Internationalization guide
|
|
||||||
# at https://guides.rubyonrails.org/i18n.html.
|
|
||||||
#
|
|
||||||
# Be aware that YAML interprets the following case-insensitive strings as
|
|
||||||
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
|
||||||
# must be quoted to be interpreted as strings. For example:
|
|
||||||
#
|
|
||||||
# en:
|
|
||||||
# "yes": yup
|
|
||||||
# enabled: "ON"
|
|
||||||
|
|
||||||
en:
|
|
||||||
hello: "Hello world"
|
|
||||||
93
config/logging.php
Normal file
93
config/logging.php
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'channels' => [
|
||||||
|
'stack' => [
|
||||||
|
'driver' => 'stack',
|
||||||
|
'channels' => ['single'],
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'days' => 14,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => 'Laravel Log',
|
||||||
|
'emoji' => ':boom:',
|
||||||
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => LOG_USER,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => NullHandler::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
125
config/mail.php
Normal file
125
config/mail.php
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send any email
|
||||||
|
| messages sent by your application. Alternative mailers may be setup
|
||||||
|
| and used as needed; however, this mailer will be used by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'smtp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||||
|
| sending an e-mail. You will specify which one you are using for your
|
||||||
|
| mailers below. You are free to add additional mailers as required.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "log", "array", "failover"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailers' => [
|
||||||
|
'smtp' => [
|
||||||
|
'transport' => 'smtp',
|
||||||
|
'url' => env('MAIL_URL'),
|
||||||
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||||
|
'port' => env('MAIL_PORT', 587),
|
||||||
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
'timeout' => null,
|
||||||
|
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'transport' => 'mailgun',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all e-mails sent by your application to be sent from
|
||||||
|
| the same address. Here, you may specify a name and address that is
|
||||||
|
| used globally for all e-mails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Markdown Mail Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using Markdown based email rendering, you may configure your
|
||||||
|
| theme and component paths here, allowing you to customize the design
|
||||||
|
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'markdown' => [
|
||||||
|
'theme' => 'default',
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views/vendor/mail'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
# This configuration file will be evaluated by Puma. The top-level methods that
|
|
||||||
# are invoked here are part of Puma's configuration DSL. For more information
|
|
||||||
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
|
||||||
#
|
|
||||||
# Puma starts a configurable number of processes (workers) and each process
|
|
||||||
# serves each request in a thread from an internal thread pool.
|
|
||||||
#
|
|
||||||
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
|
||||||
# should only set this value when you want to run 2 or more workers. The
|
|
||||||
# default is already 1.
|
|
||||||
#
|
|
||||||
# The ideal number of threads per worker depends both on how much time the
|
|
||||||
# application spends waiting for IO operations and on how much you wish to
|
|
||||||
# prioritize throughput over latency.
|
|
||||||
#
|
|
||||||
# As a rule of thumb, increasing the number of threads will increase how much
|
|
||||||
# traffic a given process can handle (throughput), but due to CRuby's
|
|
||||||
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
|
||||||
# response time (latency) of the application.
|
|
||||||
#
|
|
||||||
# The default is set to 3 threads as it's deemed a decent compromise between
|
|
||||||
# throughput and latency for the average Rails application.
|
|
||||||
#
|
|
||||||
# Any libraries that use a connection pool or another resource pool should
|
|
||||||
# be configured to provide at least as many connections as the number of
|
|
||||||
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
|
||||||
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
|
||||||
threads threads_count, threads_count
|
|
||||||
|
|
||||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
||||||
port ENV.fetch("PORT", 3000)
|
|
||||||
|
|
||||||
# Allow puma to be restarted by `bin/rails restart` command.
|
|
||||||
plugin :tmp_restart
|
|
||||||
|
|
||||||
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
|
||||||
# In other environments, only set the PID file if requested.
|
|
||||||
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
|
||||||
109
config/queue.php
Normal file
109
config/queue.php
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue API supports an assortment of back-ends via a single
|
||||||
|
| API, giving you convenient access to each back-end using the same
|
||||||
|
| syntax for every one. Here you may define a default connection.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection information for each server that
|
||||||
|
| is used by your application. A default configuration has been added
|
||||||
|
| for each back-end shipped with Laravel. You are free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'jobs',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqs' => [
|
||||||
|
'driver' => 'sqs',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Failed Queue Jobs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These options configure the behavior of failed queue job logging so you
|
||||||
|
| can control which database and table are used to store the jobs that
|
||||||
|
| have failed. You may change them to any database / table you wish.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
Rails.application.routes.draw do
|
|
||||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
||||||
|
|
||||||
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
|
||||||
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
|
||||||
get "up" => "rails/health#show", as: :rails_health_check
|
|
||||||
|
|
||||||
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
|
||||||
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
|
||||||
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
|
||||||
|
|
||||||
# Defines the root path route ("/")
|
|
||||||
root "home#index"
|
|
||||||
|
|
||||||
get "music" => "music#index"
|
|
||||||
end
|
|
||||||
21
config/services.php
Normal file
21
config/services.php
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lastfm' => [
|
||||||
|
'key' => env('LASTFM_KEY'),
|
||||||
|
'user' => env('LASTFM_USER'),
|
||||||
|
]
|
||||||
|
];
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue