pobthebuilder / resolve-flatpak

Flatpak packaging for Blackmagicdesign DaVinci Resolve
MIT License
129 stars 21 forks source link

download resolve within the flatpak #1

Closed MaxBrandtner closed 1 year ago

MaxBrandtner commented 1 year ago

The following is taken from the aur package

how to download the package automatically

_downloadid='44be7e694b4e440db5d2f70ad732d3b2'
_referid='77ef91f67a9e411bbbe299e595b4cfcc'
_siteurl="https://www.blackmagicdesign.com/api/register/us/download/${_downloadid}"

_useragent="User-Agent: Mozilla/5.0 (X11; Linux ${CARCH}) \
                        AppleWebKit/537.36 (KHTML, like Gecko) \
                        Chrome/77.0.3865.75 \
                        Safari/537.36"

_reqjson="{ \
    \"firstname\": \"Arch\", \
    \"lastname\": \"Linux\", \
    \"email\": \"someone@archlinux.org\", \
    \"phone\": \"202-555-0194\", \
    \"country\": \"us\", \
    \"state\": \"New York\", \
    \"city\": \"AUR\", \
    \"product\": \"DaVinci Resolve\" \
}"

_reqjson="$(  printf '%s' "$_reqjson"   | sed 's/[[:space:]]\+/ /g')"
_useragent="$(printf '%s' "$_useragent" | sed 's/[[:space:]]\+/ /g')"
_useragent_escaped="${_useragent// /\\ }"

_srcurl="$(curl \
            -s \
            -H 'Host: www.blackmagicdesign.com' \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Origin: https://www.blackmagicdesign.com' \
            -H "$_useragent" \
            -H 'Content-Type: application/json;charset=UTF-8' \
            -H "Referer: https://www.blackmagicdesign.com/support/download/${_referid}/Linux" \
            -H 'Accept-Encoding: gzip, deflate, br' \
            -H 'Accept-Language: en-US,en;q=0.9' \
            -H 'Authority: www.blackmagicdesign.com' \
            -H 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
            --data-ascii "$_reqjson" \
            --compressed \
            "$_siteurl")"

DLAGENTS=("https::/usr/bin/curl \
            -gqb '' -C - --retry 3 --retry-delay 3 \
            -H Host:\ sw.blackmagicdesign.com \
            -H Upgrade-Insecure-Requests:\ 1 \
            -H ${_useragent_escaped} \
            -H Accept:\ text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 \
            -H Accept-Language:\ en-US,en;q=0.9 \
            -o %o \
            --compressed \
            %u")

The same could be done for the flatpak package. If there isn't a way to install packages upon install a simple script could be created, that will download davinci-resolve on first launch (having an applet showing a text and shows progress would help here)

pobthebuilder commented 1 year ago

I have this basically working. Do you know an automated way to obtain the _downloadid for e.g. the latest Resolve (free/studio) from DaVinci though?

pobthebuilder commented 1 year ago

Resolve in commit 1f38d07. We now auto-download the latest Resolve, with some configurable options. Thanks very much for the hint!

goshansp commented 1 year ago

AFAIK the current mechanism is not Flathub compatible as discussed here. I have asked Blackmagic (post not published yet at time of writing) to enable a direct URL. A direct URL would is the best way of getting to a reproducible build without additional complex magic required.