feat: Add localhost license bypass for development
All checks were successful
Create Release Package / build-release (push) Successful in 1m2s

- License check bypassed on localhost, 127.0.0.1, ::1
- Also bypassed for .local, .test, .localhost, .dev.local TLDs
- Bump version to 0.5.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 20:50:06 +01:00
parent df3b8a7ec2
commit 0627dd0db7
4 changed files with 48 additions and 4 deletions

View File

@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.5.1] - 2026-02-02
### Added
- **Localhost license bypass** - License check is automatically bypassed on local development environments
- Detects `localhost`, `127.0.0.1`, `::1`
- Detects common local TLDs: `.local`, `.test`, `.localhost`, `.dev.local`
- Allows full plugin functionality without license on development sites
## [0.5.0] - 2026-02-02
### Added

View File

@@ -2,7 +2,7 @@
Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
[![Version](https://img.shields.io/badge/version-0.5.0-blue.svg)](CHANGELOG.md)
[![Version](https://img.shields.io/badge/version-0.5.1-blue.svg)](CHANGELOG.md)
[![PHP](https://img.shields.io/badge/PHP-%3E%3D8.3-purple.svg)](https://php.net)
[![WordPress](https://img.shields.io/badge/WordPress-%3E%3D6.4-blue.svg)](https://wordpress.org)
[![License](https://img.shields.io/badge/license-GPL--2.0%2B-green.svg)](https://www.gnu.org/licenses/gpl-2.0.html)

View File

@@ -421,15 +421,50 @@ final class Manager {
/**
* Check if the license is currently valid.
*
* Uses cached status for performance.
* Uses cached status for performance. Bypasses license check on localhost.
*
* @return bool
*/
public static function is_license_valid(): bool {
// Bypass license check on localhost for development.
if ( self::is_localhost() ) {
return true;
}
$status = get_option( self::OPTION_LICENSE_STATUS, 'unchecked' );
return 'valid' === $status;
}
/**
* Check if the current site is running on localhost.
*
* @return bool
*/
public static function is_localhost(): bool {
$host = wp_parse_url( home_url(), PHP_URL_HOST );
// Common localhost identifiers.
$localhost_hosts = array(
'localhost',
'127.0.0.1',
'::1',
);
if ( in_array( $host, $localhost_hosts, true ) ) {
return true;
}
// Common local development TLDs.
$local_tlds = array( '.local', '.test', '.localhost', '.dev.local' );
foreach ( $local_tlds as $tld ) {
if ( str_ends_with( $host, $tld ) ) {
return true;
}
}
return false;
}
/**
* Get the license key.
*

View File

@@ -3,7 +3,7 @@
* Plugin Name: WP FediStream
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-fedistream
* Description: Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
* Version: 0.5.0
* Version: 0.5.1
* Requires at least: 6.4
* Requires PHP: 8.3
* Author: Marco Graetsch
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
*
* @var string
*/
define( 'WP_FEDISTREAM_VERSION', '0.5.0' );
define( 'WP_FEDISTREAM_VERSION', '0.5.1' );
/**
* Plugin file path.