diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index defe8a4..33f06b3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -56,7 +56,7 @@ jobs: - name: Install plugin dependencies run: | cd pelican - composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0" + composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0" "socialiteproviders/pocketid:^5.0" - name: Setup .env file run: cp pelican/.env.example pelican/.env diff --git a/README.md b/README.md index 5ea45c0..2d23950 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre - [Minecraft Modrinth](/minecraft-modrinth) - Download Minecraft mods & plugins from Modrinth - [PasteFox Share](/pastefox-share) - Share console logs via pastefox.com - [Player Counter](/player-counter) - Show connected players count for game servers +- [PocketID Provider](/pocketid-provider) - Allows you to use PocketID as an OAuth provider - [Register](/register) - Enable user self-registration on all panels - [Robo Avatars](/robo-avatars) - Adds RoboHash as avatar provider - [Rust uMod](/rust-umod) - Download Rust plugins from uMod diff --git a/pocketid-provider/README.md b/pocketid-provider/README.md new file mode 100644 index 0000000..5322f75 --- /dev/null +++ b/pocketid-provider/README.md @@ -0,0 +1,12 @@ +# Pocket ID Provider (by Ebnater) + +This plugin allows you to use PocketID as OAuth Provider. + +## Features + +- Register PocketID as OAuth Provider +- Integrates with the already known OAuth Tab in Pelican Panel Settings + +## Credits to devilr33f + +I used the `PocketIDSchema.php` file from [devilr33f's pelican-pocketid repository](https://github.com/devilr33f/pelican-pocketid/blob/51292e9d52f31fd185fd1ba5a6d8fd34bf23a42c/patch/PocketIDSchema.php). \ No newline at end of file diff --git a/pocketid-provider/plugin.json b/pocketid-provider/plugin.json new file mode 100644 index 0000000..d5bdee1 --- /dev/null +++ b/pocketid-provider/plugin.json @@ -0,0 +1,17 @@ +{ + "id": "pocketid-provider", + "name": "PocketID Provider", + "author": "Ebnater", + "version": "1.0.0", + "description": "Allows you to use PocketID as an OAuth provider.", + "category": "plugin", + "url": "https://github.com/pelican-dev/plugins/tree/main/pocketid-provider", + "update_url": null, + "namespace": "Ebnater\\PocketIDProvider", + "class": "PocketIDProviderPlugin", + "panels": null, + "panel_version": null, + "composer_packages": { + "socialiteproviders/pocketid": "^5.0" + } +} \ No newline at end of file diff --git a/pocketid-provider/src/Extensions/OAuth/Schemas/PocketIDSchema.php b/pocketid-provider/src/Extensions/OAuth/Schemas/PocketIDSchema.php new file mode 100644 index 0000000..526b20a --- /dev/null +++ b/pocketid-provider/src/Extensions/OAuth/Schemas/PocketIDSchema.php @@ -0,0 +1,95 @@ + env('OAUTH_POCKETID_BASE_URL'), + ]); + } + + public function getSetupSteps(): array + { + return array_merge([ + Step::make('Configure Pocket ID Application') + ->schema([ + TextEntry::make('instructions') + ->hiddenLabel() + ->state(new HtmlString(Blade::render(' +
    +
  1. Log in to your Pocket ID instance
  2. +
  3. Navigate to your application or create a new OAuth application
  4. +
  5. Copy the Client ID and Client Secret from your Pocket ID application
  6. +
  7. Configure the redirect URL shown below in your Pocket ID application settings
  8. +
+ '))), + TextInput::make('_noenv_callback') + ->label('Callback URL') + ->dehydrated() + ->disabled() + ->default(fn () => url('/auth/oauth/callback/pocketid')), + ]), + ], parent::getSetupSteps()); + } + + public function getSettingsForm(): array + { + return array_merge(parent::getSettingsForm(), [ + TextInput::make('OAUTH_POCKETID_BASE_URL') + ->label('Base URL') + ->placeholder('https://id.example.com') + ->columnSpan(2) + ->required() + ->url() + ->autocomplete(false) + ->default(env('OAUTH_POCKETID_BASE_URL')), + TextInput::make('OAUTH_POCKETID_DISPLAY_NAME') + ->label('Display Name') + ->placeholder('Pocket ID') + ->autocomplete(false) + ->default(env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID')), + ColorPicker::make('OAUTH_POCKETID_DISPLAY_COLOR') + ->label('Display Color') + ->placeholder('#000000') + ->default(env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000')) + ->hex(), + ]); + } + + public function getName(): string + { + return env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID'); + } + + public function getIcon(): string + { + return 'tabler-id'; + } + + public function getHexColor(): string + { + return env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000'); + } +} diff --git a/pocketid-provider/src/PocketIDProviderPlugin.php b/pocketid-provider/src/PocketIDProviderPlugin.php new file mode 100644 index 0000000..88a80f5 --- /dev/null +++ b/pocketid-provider/src/PocketIDProviderPlugin.php @@ -0,0 +1,18 @@ +app->make(OAuthService::class); + $service->register(new PocketIDSchema()); + } +}