Secure way to add JS Script to WordPress filesystem

Thank you @Tom J Nowell letting me think about this. I had to think about it the last day, and this is the safe way to do this.

function lwb_jquery() {
    
    $message="";
    
    // Multisite Support
    if( is_multisite()) {
        $uri = get_stylesheet_directory() . '/sites/' . get_current_blog_id(). '/assets/js/lwb-script.js';
        $file_path="[AKTIVES THEME]/sites/" . get_current_blog_id() . '/assets/js/lwb-script.js';
        
        if( !file_exists( $uri ) || get_option('lwb_jquery') === '' ) {
            $message="<strong>Achtung:</strong> JS Datei muss manuell erstellt werden in: <strong>" . $file_path . '</strong>';
        } 
        elseif( file_exists( $uri ) && get_option('lwb_jquery') === 'on' ) {
            $message="Super, das Skript kann jetzt verwendet werden unter: <strong>" . $file_path . '</strong>';
        }   
    } else {
        $uri = get_stylesheet_directory() . '/assets/js/lwb-script.js';
        $file_path="[AKTIVES THEME]/assets/js/lwb-script.js";
        
        if( !file_exists( $uri ) || get_option('lwb_jquery') === '' ) {
            $message="<strong>Achtung:</strong> JS Datei muss manuell erstellt werden in: <strong>" . $file_path . '</strong>';
        }           
        elseif( file_exists( $uri ) && get_option('lwb_jquery') === 'on' ) {
            $message="Super, das Skript kann jetzt verwendet werden unter: <strong>" . $file_path . '</strong>';
        }   
    }
    
    return $message;
    
}
    

// Registrieren und einbinden der Javascript Datei
function lwb_jquery_script() {
    if( get_option('lwb_jquery') === 'on' ) {   
        // Multisite Support
        if( is_multisite()) {
            $url = get_stylesheet_directory_uri() . '/sites/' . get_current_blog_id() . '/assets/js/lwb-script.js';
            wp_enqueue_script('lwb-script', $url, array('jquery'), '1.0', true);    
        } else {
            wp_enqueue_script('lwb-script', get_stylesheet_directory_uri() . '/assets/js/lwb-script.js', array('jquery'), '1.0', true);
        }
    }
}
add_action('wp_enqueue_scripts', 'lwb_jquery_script');  

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino