- Want to make sure people find you on Twitter? Add your handle above to guide them there!
+ Want to make sure people find you on Twitter (currently X)? Add your handle above to guide them there!
+
+
+
+
+
+
+
+
+ @
+
+
+ @error('mastodon')
+
{{ $message }}
+ @enderror
+
+
+ Want to make sure people find you on Mastodon? Add your handle above to guide them there!
+
+
+
+
+
+
+
+
+ @
+
+
+ @error('bluesky')
+
{{ $message }}
+ @enderror
+
+
+ Want to make sure people find you on Bluesky? Add your handle above to guide them there!
From 5148d40d29cc40adc52721000f277e01205774f9 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Tue, 30 Jan 2024 18:25:15 +0100
Subject: [PATCH 3/5] feat: make invite code columns in db unique
---
...4_01_26_201135_drop_profile_categories.php | 2 --
...ter_application_invite_codes_to_unique.php | 30 +++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 database/migrations/2024_01_30_001055_alter_application_invite_codes_to_unique.php
diff --git a/database/migrations/2024_01_26_201135_drop_profile_categories.php b/database/migrations/2024_01_26_201135_drop_profile_categories.php
index 950580f..bdb771e 100644
--- a/database/migrations/2024_01_26_201135_drop_profile_categories.php
+++ b/database/migrations/2024_01_26_201135_drop_profile_categories.php
@@ -17,7 +17,6 @@ public function up(): void
$table->dropColumn('is_fursuit');
$table->dropColumn('is_commissions');
$table->dropColumn('is_misc');
- $table->dropColumn('is_mature');
});
}
@@ -32,7 +31,6 @@ public function down(): void
$table->boolean('is_fursuit')->nullable();
$table->boolean('is_commissions')->nullable();
$table->boolean('is_misc')->nullable();
- $table->boolean('is_mature')->nullable();
});
}
};
diff --git a/database/migrations/2024_01_30_001055_alter_application_invite_codes_to_unique.php b/database/migrations/2024_01_30_001055_alter_application_invite_codes_to_unique.php
new file mode 100644
index 0000000..dc1aafb
--- /dev/null
+++ b/database/migrations/2024_01_30_001055_alter_application_invite_codes_to_unique.php
@@ -0,0 +1,30 @@
+string('invite_code_shares')->nullable()->unique()->change();
+ $table->string('invite_code_assistants')->nullable()->unique()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('applications', function (Blueprint $table) {
+ $table->string('invite_code_shares')->nullable()->change();
+ $table->string('invite_code_assistants')->nullable()->change();
+ });
+ }
+};
From 3fb40f747cb117713fccb972196019b300ec03ed Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Mon, 29 Jan 2024 23:36:26 +0100
Subject: [PATCH 4/5] socials
---
app/Filament/Resources/ProfileResource.php | 6 +++
app/Http/Controllers/ProfileController.php | 12 ++++++
app/Models/Application.php | 2 +
database/factories/ProfileFactory.php | 2 +
...222300_add_bluesky_mastodon_to_profile.php | 30 +++++++++++++
lang/en/validation.php | 6 +++
resources/views/forms/profile.blade.php | 42 ++++++++++++++++++-
7 files changed, 98 insertions(+), 2 deletions(-)
create mode 100644 database/migrations/2024_01_29_222300_add_bluesky_mastodon_to_profile.php
diff --git a/app/Filament/Resources/ProfileResource.php b/app/Filament/Resources/ProfileResource.php
index ecafe04..bff0897 100644
--- a/app/Filament/Resources/ProfileResource.php
+++ b/app/Filament/Resources/ProfileResource.php
@@ -29,6 +29,10 @@ public static function form(Form $form): Form
->maxLength(255),
Forms\Components\TextInput::make('twitter')
->maxLength(1024),
+ Forms\Components\TextInput::make('mastodon')
+ ->maxLength(1024),
+ Forms\Components\TextInput::make('bluesky')
+ ->maxLength(1024),
Forms\Components\TextInput::make('telegram')
->maxLength(1024),
Forms\Components\TextInput::make('discord')
@@ -83,6 +87,8 @@ public static function table(Table $table): Table
Tables\Columns\TextColumn::make('art_desc'),
Tables\Columns\TextColumn::make('website'),
Tables\Columns\TextColumn::make('twitter'),
+ Tables\Columns\TextColumn::make('mastodon'),
+ Tables\Columns\TextColumn::make('bluesky'),
Tables\Columns\TextColumn::make('telegram'),
Tables\Columns\TextColumn::make('discord'),
Tables\Columns\TextColumn::make('tweet'),
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index ccd4d1c..28d9ed9 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -31,6 +31,8 @@ public static function createOrUpdate(Request $request, int $applicationId): Pro
"art_desc" => $request->get('art_desc'),
"website" => $request->get('profile_website'),
"twitter" => $request->get('twitter'),
+ "mastodon" => $request->get('mastodon'),
+ "bluesky" => $request->get('bluesky'),
"telegram" => $request->get('telegram'),
"discord" => $request->get('discord'),
"tweet" => $request->get('tweet'),
@@ -144,6 +146,16 @@ public static function getValidations()
// Twitter user name validation: https://help.twitter.com/en/managing-your-account/twitter-username-rules
'regex:/^[0-9a-z_]{4,15}$/i',
],
+ "mastodon" => [
+ 'nullable',
+ 'regex:/^([0-9a-z_]{3,64})@([0-9a-z_]{3,64})\.([0-9a-z_.]{2,64})$/i',
+ // TODO: improve validation
+ ],
+ "bluesky" => [
+ 'nullable',
+ 'regex:/^[0-9a-z_.]{3,64}$/i',
+ // TODO: improve validation
+ ],
"telegram" => [
'nullable',
// Telegram user name validation: https://core.telegram.org/method/account.checkUsername
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 8d202c8..080953d 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -385,6 +385,8 @@ public static function getAllApplicationsForAppExport()
'art_desc AS About the Art',
'profiles.website as Website',
'twitter as Twitter',
+ 'mastodon as Mastodon',
+ 'bluesky as Bluesky',
'telegram as Telegram',
'art_preview_caption as Art Preview Caption',
DB::raw("CASE WHEN image_thumbnail IS NOT NULL THEN 'X' ELSE '' END AS 'ThumbailImg'"),
diff --git a/database/factories/ProfileFactory.php b/database/factories/ProfileFactory.php
index 2daf1d0..8612803 100644
--- a/database/factories/ProfileFactory.php
+++ b/database/factories/ProfileFactory.php
@@ -18,6 +18,8 @@ public function definition(): array
'art_desc' => $this->faker->text(),
'website' => $this->faker->word(),
'twitter' => $this->faker->word(),
+ 'mastodon' => $this->faker->word(),
+ 'bluesky' => $this->faker->word(),
'telegram' => $this->faker->word(),
'discord' => $this->faker->word(),
'tweet' => $this->faker->text(),
diff --git a/database/migrations/2024_01_29_222300_add_bluesky_mastodon_to_profile.php b/database/migrations/2024_01_29_222300_add_bluesky_mastodon_to_profile.php
new file mode 100644
index 0000000..4b64338
--- /dev/null
+++ b/database/migrations/2024_01_29_222300_add_bluesky_mastodon_to_profile.php
@@ -0,0 +1,30 @@
+string('mastodon')->nullable()->default(null);
+ $table->string('bluesky')->nullable()->default(null);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('profiles', function (Blueprint $table) {
+ $table->dropColumn('mastodon');
+ $table->dropColumn('bluesky');
+ });
+ }
+};
diff --git a/lang/en/validation.php b/lang/en/validation.php
index 564f420..fd93b37 100644
--- a/lang/en/validation.php
+++ b/lang/en/validation.php
@@ -29,6 +29,12 @@
'twitter' => [
'regex' => 'Please verify your Twitter handle, it must be between 4 and 15 characters and only contain letters, numbers and underscores (_).'
],
+ 'mastodon' => [
+ 'regex' => 'Please verify your Mastodon handle, it must be in the format username@instance.name' // TODO: update if needed
+ ],
+ 'bluesky' => [
+ 'regex' => 'Please verify your Bluesky handle, it must be between 3 and 64 characters and only contain letters, numbers, dots (.) and underscores (_).' // TODO: update if needed
+ ],
'telegram' => [
'regex' => 'Please verify your Telegram handle, it must be between 5 and 32 characters and only contain letters, numbers and underscores (_).'
],
diff --git a/resources/views/forms/profile.blade.php b/resources/views/forms/profile.blade.php
index db4dfd8..ea001ce 100644
--- a/resources/views/forms/profile.blade.php
+++ b/resources/views/forms/profile.blade.php
@@ -269,7 +269,7 @@ class="form-control @error('profile_website') is-invalid @enderror" id="profile_
- Want to make sure people find you on Twitter? Add your handle above to guide them there!
+ Want to make sure people find you on Twitter (currently X)? Add your handle above to guide them there!
+
+
+
+
+
+
+
+
+ @
+
+
+ @error('mastodon')
+
{{ $message }}
+ @enderror
+
+
+ Want to make sure people find you on Mastodon? Add your handle above to guide them there!
+
+
+
+
+
+
+
+
+ @
+
+
+ @error('bluesky')
+
{{ $message }}
+ @enderror
+
+
+ Want to make sure people find you on Bluesky? Add your handle above to guide them there!
From 69140031d3fe91e245ce7cb069b60cf3b3c27019 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Tue, 30 Jan 2024 23:37:50 +0100
Subject: [PATCH 5/5] feat(profile): patterns for bsky and mastodon validation
---
app/Http/Controllers/ProfileController.php | 28 +++++++++++++++-------
lang/en/validation.php | 4 ++--
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 28d9ed9..2651abb 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -15,12 +15,10 @@ class ProfileController extends Controller
public function index()
{
-
}
public function create(Request $request)
{
-
}
public static function createOrUpdate(Request $request, int $applicationId): Profile
@@ -88,12 +86,10 @@ public static function getByApplicationId(int|null $applicationId): Profile|null
public function store(Request $request)
{
-
}
public function show(Profile $profile)
{
-
}
public function edit(Profile $profile)
@@ -148,13 +144,29 @@ public static function getValidations()
],
"mastodon" => [
'nullable',
- 'regex:/^([0-9a-z_]{3,64})@([0-9a-z_]{3,64})\.([0-9a-z_.]{2,64})$/i',
- // TODO: improve validation
+ // Mastodon user name validation loosely based on
+ // https://docs.joinmastodon.org/spec/webfinger/#intro and
+ // https://datatracker.ietf.org/doc/html/rfc7565#section-7
+ /*
+ * acctURI = "acct" ":" userpart "@" host
+ * userpart = unreserved / sub-delims 0*( unreserved / pct-encoded / sub-delims )
+ * host = IP-literal / IPv4address / reg-name
+ * IP-literal = "[" ( IPv6address / IPvFuture ) "]"
+ * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
+ * reg-name = *( unreserved / pct-encoded / sub-delims )
+ * reserved = gen-delims / sub-delims
+ * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"/ "*" / "+" / "," / ";" / "="
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ */
+ 'regex:/([A-Z0-9\-._~!$&\'\(\)\*,;=][A-Z0-9\-._~%!$&\'\(\)\*,;=]*)@([A-Z0-9\-._~%!$&\'\(\)\*,;=]+\.[A-Z]{2,})/i'
],
"bluesky" => [
'nullable',
- 'regex:/^[0-9a-z_.]{3,64}$/i',
- // TODO: improve validation
+ // Bluesky user name validation:
+ // https://atproto.com/specs/handle
+ 'regex:/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/',
],
"telegram" => [
'nullable',
diff --git a/lang/en/validation.php b/lang/en/validation.php
index fd93b37..67001d2 100644
--- a/lang/en/validation.php
+++ b/lang/en/validation.php
@@ -30,10 +30,10 @@
'regex' => 'Please verify your Twitter handle, it must be between 4 and 15 characters and only contain letters, numbers and underscores (_).'
],
'mastodon' => [
- 'regex' => 'Please verify your Mastodon handle, it must be in the format username@instance.name' // TODO: update if needed
+ 'regex' => 'Please verify your Mastodon handle, it must be in the format username@instance.name'
],
'bluesky' => [
- 'regex' => 'Please verify your Bluesky handle, it must be between 3 and 64 characters and only contain letters, numbers, dots (.) and underscores (_).' // TODO: update if needed
+ 'regex' => 'Please verify your Bluesky handle, it may only contain letters, numbers, dots (.) and hyphens (-).'
],
'telegram' => [
'regex' => 'Please verify your Telegram handle, it must be between 5 and 32 characters and only contain letters, numbers and underscores (_).'