julianxhokaxhiu / LineageOTA

A simple OTA REST Server for LineageOS OTA Updater System Application
http://blog.julianxhokaxhiu.com/how-the-cm-ota-server-works-and-how-to-implement-and-use-ours
MIT License
221 stars 132 forks source link

[QUESTION] Use for other roms #73

Closed 46620 closed 3 years ago

46620 commented 3 years ago

I was wondering if there's a way to use this with roms that aren't Lineage? I tried with my build of BlissRoms and when I check the API it just returns {"id":null,"result":[],"error":null}. I'm using nginx and the config is below in case it has issues

server {
        root /var/www/LineageOTA;

        index index.php;

        server_name ota.mysite.tld;

        proxy_set_header Forwarded "host=$host;proto=https";

        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

        location ~ /\.ht {
                deny all;
        }

        location /builds {
                autoindex on;
                autoindex_exact_size off;
                try_files $uri $uri/ /index.php?$args;
        }

        listen [::]:443 ssl http2; # managed by Certbot
        listen 443 ssl http2; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/mysite.tld-0001/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/mysite.tld-0001/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
        listen 80;
        listen [::]:80;
        server_name ota.mysite.tld;
        return 301 https://$server_name$request_uri;
}
julianxhokaxhiu commented 3 years ago

Hi, I think yes as I had a PR some time ago that was extending the support for many more ROMs than I thought. Make sure your actual ZIPs are placed inside of the builds/full directory and that you're able to see the API result page using the OTA Unit Tester mentioned in the README.

Regarding the config, you need to make sure the rewrite is on the / path like this example:

server {
    location / {
        try_files $uri $uri/ /index.php;
    }
}

Cheers!

46620 commented 3 years ago

Managed to fix it, rebuilding from source solved the problem.