mercredi 13 septembre 2023

Metamask Dapp Browser Not Redirecting from HTTP to HTTPS on Certain Mobile Phones

I'm developing a web-based decentralized application (Dapp) that interacts with Ethereum using Metamask. I've noticed an issue with the Metamask Dapp browser on some mobile phones. When users type a URL with the http protocol instead of https, the Dapp browser does not automatically redirect to the secure https version of the website.

On most mobile phones, this redirection works as expected, but on a subset of devices, it doesn't. This behavior is causing a security concern as the application relies on HTTPS to ensure the confidentiality and integrity of data.

Here are some details:

  • The web server is properly configured to handle both HTTP and HTTPS requests.
  • The APP_URL in my Laravel application is set to use https in the .env file.
  • The Metamask extension is up to date on all devices.

I'd like to understand why this issue is occurring and if there are any specific settings or configurations I need to adjust to ensure that the Metamask Dapp browser consistently redirects from HTTP to HTTPS on all mobile devices.

Has anyone encountered a similar issue with Metamask on mobile phones, and if so, how did you resolve it? Any insights or guidance on this matter would be greatly appreciated.



via Chebli Mohamed

lundi 11 septembre 2023

laravel-permission Is there a binding relationship between permissions and routes when the user middleware determines permissions?

For example, in the following figure: permission:member_info|member_add is added to the member routing group. If a user has one of these two permissions, the entire member routing can be accessed. Do we have to write them down on specific routes one by one? That's a lot. It doesn't feel that way. If it is not written in the specific route, how should this permission and route be bound? enter image description here

I don't know what to do at the moment, but I feel that it is unscientific to write on the route one by one.

Like the previous comparison url, the permission is the url, which is checked from the data table and compared with the current request url



via Chebli Mohamed

lundi 4 septembre 2023

Connecting to an SFTP using Storage in Laravel

I Stumbled upon (not sure if its unique) a very tricky situation , when I try to connect to an SFTP with invalid credentials or is not enabled.

The first time I try to connect to SFTP which is not available it throws me proper error message but If I try to reconnect to same SFTP within a minute or 2 it does not throw any exception, I tested the same via php artisan tinker of LARAVEL.

    function conectToSFTP()
    {
        $diskName = 'sftp_name';
        try {
            $disk = Storage::disk($diskName);
            $files = $disk->files('/');
            echo "connected to sftp";
        } catch (\Exception $e) {
            echo "Unable to connect to SFTP " . $e->getMessage();
        }
    }

enter image description here

How can I get proper error message second time as well. Due to some reason or based on some condition I have to call

Storage::disk($diskName);

twice.

I tried adding a time delay using

sleep(45);

but that didnt worked



via Chebli Mohamed

Xlsx file not able to read data in laravel 5.2

I am using laravel 5.2 and "maatwebsite/excel": "~2.1.0", I am not able to read xlsx file data i am getting response empty data My code is here

Excel::load($filePathNew, function($reader) {
$results = $reader-\>get();
$results = $reader-\>all();
dd($results);
});


via Chebli Mohamed

dimanche 3 septembre 2023

Laravel SearchDropdown - to implement SearchDropdown in my laravel project

i want to implement SearchDropdown in my laravel project so i have in issue that i do not have search results this is my SearchDropdown.php file `<?php namespace App\Livewire;

use Livewire\Component; use Illuminate\Support\Facades\Http;

class SearchDropdown extends Component { public $search = '';

public function render()
{
     $searchResults = [];

    if (strlen($this->search) >= 2 )
    // if (!empty($this->search))
    {
        $response = Http::withToken(config('services.tmdb.token'))
            ->get('https://api.themoviedb.org/3/search/movie', [
                'query' => $this->search,
            ]);

        if ($response->ok()) {
            $searchResults = $response->json()['results'];
        }
    }

    return view('livewire.search-dropdown', [
        'searchResults' => collect($searchResults)->take(7),
    ]);
}

}`

and this is my component `

<div wire:loading class="spinner top-0 right-0 mr-4 mt-3"></div>

@if (strlen($search) >= 2)
    <div class="absolute bg-gray-800 text-sm rounded w-64 mt-4">
        @if ($searchResults->count() > 0)
            <ul>
                @foreach ($searchResults as $result)
                    <li class="border-b border-gray-700">
                        <a href="" class="block hover:bg-gray-700 px-3 py-3 items-center transition ease-in-out duration-150">
                            @if ($result['poster_path'])
                            <img src="https://image.tmdb.org/t/p/w92/" alt="poster" class="w-8">
                        @else
                            <img src="https://via.placeholder.com/50x75" alt="poster" class="w-8">
                        @endif
                        <span class="ml-4"></span>
                    </a>
                    </li>
                @endforeach

            </ul>
        @else
            <div class="px-3 py-3">No results for ""</div>
        @endif
    </div>
@endif
`

i try to implement SearchDropdown in my laravel project to wite a movie name in the SearchDropdown but i have no resualts



via Chebli Mohamed

vendredi 1 septembre 2023

Seeking Guidance for Migrating Laravel 5.4 Web App to a New Domain [closed]

I'm in need of your valuable advice.

We are currently working on a Laravel project, and our Laravel web app is connected to a mobile app via an API. Now, we're planning to move the web app to a new domain. However, there's a catch - our Laravel version is a very outdated 5.4 version, and unfortunately, we've lost access to the source code. Luckily, we do have a server backup file.

Could anyone kindly suggest a method for deploying this code on the new domain?

Thank you in advance.

Laravel 5.4 Web App Migration Help Required.



via Chebli Mohamed

Authentification failed [closed]

I develop in Laravel and I need to do authentication with two roles but it does not work : if the role of the user is a technician or engineer the system must go to the homet.blade.php page ,

here the code is what the syntax is just :

@if (Auth::user()->role == "Technician" xor Auth::user()->role == "Engineer" )

window.location = "/homet";

@endif

I tried to insert the logical operation "xor" but it does not work



via Chebli Mohamed