Plugin Directory

Changeset 3435666


Ignore:
Timestamp:
01/09/2026 07:11:45 AM (2 months ago)
Author:
scordeveloper
Message:

Fix: Compliance update for naming guidelines and security refactoring. Fix serviceWorker slash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • notification-button/trunk/index.php

    r3435655 r3435666  
    3636 */
    3737add_action('template_redirect', function() {
    38     if (get_query_var('ntbutton_sw')) {
    39         header('Content-Type: application/javascript; charset=utf-8');
    40         // Service-Worker-Allowed header is required for cross-path scope
    41         header('Service-Worker-Allowed: /');
    42         echo "importScripts('https://notificationbutton.com/assets/files/serviceWorkerContain.min.js');";
    43         exit;
    44     }
     38  if (get_query_var('ntbutton_sw')) {
     39      // Prevent WordPress from adding a trailing slash to this URL
     40      remove_filter('redirect_canonical', 'redirect_canonical');
     41     
     42      header('Content-Type: application/javascript; charset=utf-8');
     43      header('Service-Worker-Allowed: /');
     44      echo "importScripts('https://notificationbutton.com/assets/files/serviceWorkerContain.min.js');";
     45      exit;
     46  }
    4547});
    4648
Note: See TracChangeset for help on using the changeset viewer.