@@ -4,10 +4,12 @@ premake.modules.install_cef = {}
44
55-- Config variables
66local CEF_PATH = " vendor/cef3/"
7- local CEF_URL_PREFIX = " https ://mirror.mtasa .com/bdata/cef/ "
7+ local CEF_URL_PREFIX = " http ://opensource.spotify .com/cefbuilds/cef_binary_ "
88local CEF_URL_SUFFIX = " _windows32_minimal.tar.bz2"
99
10- local CEF_VERSION = " 80.0.4+g74f7b0c+chromium-80.0.3987.122" -- Change here to update CEF version
10+ -- Change here to update CEF version
11+ local CEF_VERSION = " 80.0.4+g74f7b0c+chromium-80.0.3987.122"
12+ local CEF_HASH = " 8FD8E24AF196F00FEAAA1553496BAE99D8196BA023D0DD0FE44EFEEE93B04DFC"
1113
1214function make_cef_download_url ()
1315 return CEF_URL_PREFIX .. http .escapeUrlParam (CEF_VERSION ).. CEF_URL_SUFFIX
@@ -21,28 +23,24 @@ newaction {
2123 -- Only execute on Windows
2224 if os .host () ~= " windows" then return end
2325
24- -- Download md5
25- local correct_checksum , result_string = http .get (make_cef_download_url ().. " .md5" )
26- if result_string ~= " OK" and result_string then
27- print (" Could not check CEF checksum: " .. result_string )
28- return -- Do nothing and rely on earlier installed files (to allow working offline)
29-
30- -- TODO(jusonex): It might make sense to fallback to spotify cef mirror
31- end
32-
33- -- Trim whitespace
34- correct_checksum = correct_checksum :gsub (" [%s%c]" , " " )
35-
36- -- Check md5
26+ -- Check file hash
3727 local archive_path = CEF_PATH .. " temp.tar.bz2"
38- if os .isfile (archive_path ) and os .md5_file (archive_path ) == correct_checksum then
28+ if os .isfile (archive_path ) and os .sha256_file (archive_path ) == CEF_HASH then
3929 print (" CEF consistency checks succeeded" )
4030 return
4131 end
4232
4333 -- Download CEF
4434 print (" Downloading CEF..." )
45- http .download (make_cef_download_url (), archive_path )
35+ local result_str , response_code = http .download (make_cef_download_url (), archive_path )
36+ if result_str ~= " OK" and response_code ~= 200 then
37+ term .pushColor (term .red )
38+ io.write ((" Could not download CEF with status code %d: " ):format (response_code ))
39+ term .setTextColor (term .purple )
40+ print (result_str )
41+ term .popColor ()
42+ return
43+ end
4644
4745 -- Delete old CEF files
4846 -- TODO: It might be better to download the files into a new folder and delete this folder at once
@@ -56,10 +54,10 @@ newaction {
5654 -- Extract first bz2 and then tar
5755 os .extract_archive (archive_path , CEF_PATH , true ) -- Extract .tar.bz2 to .tar
5856 os .extract_archive (CEF_PATH .. " temp.tar" , CEF_PATH , true ) -- Extract .tar
59-
57+
6058 -- Move all files from cef_binary*/* to ./
6159 os .expanddir_wildcard (CEF_PATH .. " cef_binary*" , CEF_PATH )
62-
60+
6361 -- Delete .tar archive, but keep .tar.bz2 for checksumming
6462 os.remove (CEF_PATH .. " temp.tar" )
6563 end
0 commit comments