Changeset 2954946
- Timestamp:
- 08/17/2023 12:49:31 PM (19 months ago)
- Location:
- lnurl-auth
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
lnurl-auth/trunk/classes/Assets.php
r2835912 r2954946 11 11 * @since 1.0.0 12 12 */ 13 14 // https://www.php.net/manual/en/class.allowdynamicproperties.php 15 #[\AllowDynamicProperties] 16 13 17 class Assets { 14 18 … … 93 97 }; 94 98 95 // function to cycle up until background found 99 // function to cycle up until background found 96 100 Element.prototype.lnurlGetRealBackgroundColor = function() { 97 101 const element = this; 98 102 const transparent = "rgba(0, 0, 0, 0)"; 99 103 if (!element) return transparent; 100 104 101 105 var bg = getComputedStyle(element).backgroundColor; 102 106 if (bg === "transparent" || bg === "rgba(0, 0, 0, 0)" && null !== element.parentElement) { … … 107 111 }; 108 112 109 // function to cycle up until color found 113 // function to cycle up until color found 110 114 Element.prototype.lnurlGetRealColor = function() { 111 115 const element = this; 112 116 const transparent = "rgba(0, 0, 0, 0)"; 113 117 if (!element) return transparent; 114 118 115 119 var color = getComputedStyle(element).color; 116 120 if (color === "transparent" || color === "rgba(0, 0, 0, 0)" && null !== element.parentElement) { … … 139 143 return; 140 144 } 141 145 142 146 const data = new FormData(); 143 147 data.append( "action", "js_initialize_lnurl_auth" ); … … 148 152 element.classList.add(`⚡️`); 149 153 // console.log("Request from:", element); 150 154 151 155 fetch("' . admin_url( 'admin-ajax.php' ) . '", { 152 156 method: "POST", … … 221 225 if (seconds.innerText != mseconds_remaining) seconds.innerText = (String(mseconds_remaining).length <= 1 ? "0" + mseconds_remaining : mseconds_remaining); 222 226 if ( 223 clock_img && clock_img.alt != clock_icon || 227 clock_img && clock_img.alt != clock_icon || 224 228 !clock_img && clock.innerText == clock_icon 225 229 ) { … … 240 244 for (let lnurlAuthInstance of lnurlAuthInstances) { 241 245 intersectionObserver.observe(lnurlAuthInstance); 242 lnurlAuthInstance.lnurlAuthRequest(); 246 lnurlAuthInstance.lnurlAuthRequest(); 243 247 lnurlAuthInstance.querySelector("." + lnurlAuthElementClass + "-reinit").addEventListener("click", function() { 244 248 lnurlAuthInstance.lnurlAuthReset(); … … 256 260 public function lnurl_auth_css() { 257 261 return ' 258 .lnurl-auth, 259 .lnurl-auth-qrcode, 262 .lnurl-auth, 263 .lnurl-auth-qrcode, 260 264 .lnurl-auth-permalink { position: relative; width: 100%; } 261 265 262 266 .lnurl-auth { display: flex; flex-wrap: wrap; color: inherit; background-color: inherit; } 263 267 264 268 @keyframes lnurl_auth_loading_shimmer { 265 269 0% { background-position: -100vw 0 } … … 267 271 } 268 272 .lnurl-auth-qrcode:empty, 269 .lnurl-auth-permalink:empty { 273 .lnurl-auth-permalink:empty { 270 274 animation-duration: 2s; 271 275 animation-fill-mode: forwards; … … 279 283 } 280 284 .lnurl-auth-qrcode:empty + .lnurl-auth-qrcode-logo { opacity: .2; } 281 285 282 286 .lnurl-auth-label { flex: 0 0 100%; margin-bottom: 16px !important; color: inherit; text-align: center; } 283 287 .lnurl-auth-qrcode-wrapper { position: relative; width: 100%; padding-top: 100%; flex: 0 0 100%; margin-bottom: 16px; overflow: hidden; } … … 294 298 .lnurl-auth-timer-clock { position: relative; margin-top: .15em; margin-right: .25em; } 295 299 .lnurl-auth-timer-minutes, .lnurl-auth-timer-seconds, .lnurl-auth-timer-separator { color: inherit; font-size: .9em; opacity: .4; } 296 300 297 301 .lnurl-auth-message-wrapper { display: none; justify-content: center; align-items: center; position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 1px solid; text-align: center; } 298 302 .lnurl-auth-message-scroll-wrapper { padding: 2em; max-height: calc(100% - 4em); overflow: scroll; } … … 323 327 #loginform .lnurl-auth-permalink a { color: #F7931A } 324 328 #loginform .lnurl-auth-permalink a:hover, #loginform .lnurl-auth-permalink a:active, #loginform .lnurl-auth-permalink a:visited, { color: #EF8F1A } 325 329 326 330 body:not(.⚡️) #loginform .lnurl-auth { display: none; } 327 331 body:not(.⚡️) #loginform .lnurl-auth-loginform-wordpress-button { display: none; } 328 332 329 333 body.⚡️ #loginform .lnurl-auth-loginform-lightning-button { display: none; } 330 334 body.⚡️ #loginform .lnurl-auth-loginform-wordpress-button { display: inline-block; } -
lnurl-auth/trunk/classes/Helpers.php
r2835403 r2954946 9 9 * @since 1.0.0 10 10 */ 11 12 // https://www.php.net/manual/en/class.allowdynamicproperties.php 13 #[\AllowDynamicProperties] 14 11 15 class Helpers { 12 16 -
lnurl-auth/trunk/classes/Login.php
r2835604 r2954946 22 22 * @since 1.0.0 23 23 */ 24 25 // https://www.php.net/manual/en/class.allowdynamicproperties.php 26 #[\AllowDynamicProperties] 27 24 28 class Login { 25 29 … … 132 136 $message = '"' . sanitize_text_field( $th->getMessage() ) . '": ' . esc_html( _x( 'Verifying signature failed. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 133 137 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 134 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );135 echo json_encode(138 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 139 echo wp_json_encode( 136 140 array( 137 141 'status' => 'ERROR', … … 149 153 $message = esc_html( _x( 'No session for this k1. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 150 154 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 151 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );155 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 152 156 echo wp_json_encode( 153 157 array( … … 165 169 $message = esc_html( _x( 'Sorry, your node is banned from this site.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 166 170 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 167 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );171 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 168 172 echo wp_json_encode( 169 173 array( … … 181 185 $message = esc_html( _x( 'Sorry, your node has no access to this site.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 182 186 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 183 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );187 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 184 188 echo wp_json_encode( 185 189 array( … … 209 213 $message = esc_html( _x( 'Registrations are disabled. We are not able to create an account for you.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 210 214 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 211 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );215 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 212 216 echo wp_json_encode( 213 217 array( … … 243 247 $message = esc_html( _x( 'We failed to create a user for you. Please try again later.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 244 248 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 245 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );249 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 246 250 echo wp_json_encode( 247 251 array( … … 272 276 $message = esc_html( _x( 'We failed searching for your user account. Please try again later.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 273 277 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 274 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );278 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 275 279 echo wp_json_encode( 276 280 array( … … 286 290 lnurl_auth()->Plugin->Transients->set( $k1, true, $user_id ); 287 291 288 echo json_encode( array( 'status' => 'OK' ) );292 echo wp_json_encode( array( 'status' => 'OK' ) ); 289 293 die; 290 294 } … … 293 297 $message = esc_html( _x( 'Something went wrong. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) ); 294 298 lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message ); 295 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );296 echo json_encode(299 // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) ); 300 echo wp_json_encode( 297 301 array( 298 302 'status' => 'ERROR', -
lnurl-auth/trunk/classes/Plugin.php
r2835403 r2954946 17 17 * @since 1.0.0 18 18 */ 19 20 // https://www.php.net/manual/en/class.allowdynamicproperties.php 21 #[\AllowDynamicProperties] 22 19 23 class Plugin { 20 24 … … 77 81 */ 78 82 public function run() { 83 error_log( json_encode( array( 'k1', 'signed', 'node_linking', 'message' ) ) ); 84 79 85 // load classes 80 86 $this->load_classes( -
lnurl-auth/trunk/classes/Settings.php
r2835403 r2954946 19 19 * @since 1.0.0 20 20 */ 21 22 // https://www.php.net/manual/en/class.allowdynamicproperties.php 23 #[\AllowDynamicProperties] 24 21 25 class Settings { 22 26 -
lnurl-auth/trunk/classes/Transients.php
r2835403 r2954946 9 9 * @since 1.0.0 10 10 */ 11 12 // https://www.php.net/manual/en/class.allowdynamicproperties.php 13 #[\AllowDynamicProperties] 14 11 15 class Transients { 12 16 -
lnurl-auth/trunk/lnurl-auth.php
r2835912 r2954946 4 4 * Plugin URI: https://wordpress.org/plugins/lnurl-auth/ 5 5 * Description: This plugin provides LNURL Auth for WordPress. Login to WordPress with Bitcoin Lightning ⚡️ 6 * Version: 1.0.1 16 * Version: 1.0.12 7 7 * Author: joelmelon 8 8 * Author URI: https://lnurl-auth-for-wordpress.joelstuedle.ch -
lnurl-auth/trunk/readme.txt
r2835912 r2954946 6 6 Requires at least: 6.0 7 7 Requires PHP: 8.0.15 8 Tested up to: 6. 1.19 Stable tag: 1.0.1 110 License: GPLv3or later11 License URI: https:// www.gnu.org/licenses/gpl-3.0.html8 Tested up to: 6.3 9 Stable tag: 1.0.12 10 License: DBAD 1.1 or later 11 License URI: https://dbad-license.org/ 12 12 13 13 This plugin provides LNURL Auth for WordPress. Login to WordPress with Bitcoin Lightning ⚡️ … … 30 30 == Demo == 31 31 32 A demo WordPress installation with LNURL Auth is available [here](https://lnurl-auth-for-wordpress.joelstuedle.ch/). 32 A demo WordPress installation with LNURL Auth is available [here](https://lnurl-auth-for-wordpress.joelstuedle.ch/). 33 33 34 34 == Installation == … … 44 44 The LNURL auth QR code or URL contains a unique and time-sensitive text string. This text string is sent to the visitor's wallet. The visitor's wallet signs this text string with the private key and sends back the response with the signed text string. This signature can then be validated to confirm the visitor's identity. 45 45 46 Read the specs here: https://github.com/lnurl/luds/blob/luds/04.md 46 Read the specs here: https://github.com/lnurl/luds/blob/luds/04.md 47 47 48 48 == Vendors == … … 57 57 58 58 == Changelog == 59 60 = 1.0.12 = 61 * Add `allowdynamicproperties`, remove `error_logs` and change all callback responses to `wp_json_encode`. 59 62 60 63 = 1.0.11 =
Note: See TracChangeset
for help on using the changeset viewer.