Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
9e1bb6ef
Commit
9e1bb6ef
authored
Oct 09, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
black reformat
parent
5231d5c2
Pipeline
#283
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
26 deletions
+38
-26
uitwww/download.py
uitwww/download.py
+38
-26
No files found.
uitwww/download.py
View file @
9e1bb6ef
...
...
@@ -64,9 +64,13 @@ class Downloads:
else
:
self
.
_mirrors
=
{}
for
distro
in
self
.
config
[
"mirrors"
][
"for"
]:
found_mirrors
=
list
(
sorted
(
launchpad
.
get_cdimage_mirrors
(
distro
,
self
.
config
[
"mirrors"
][
"country"
]
)))
found_mirrors
=
list
(
sorted
(
launchpad
.
get_cdimage_mirrors
(
distro
,
self
.
config
[
"mirrors"
][
"country"
]
)
)
)
if
found_mirrors
:
self
.
_mirrors
[
distro
]
=
found_mirrors
if
not
self
.
_mirrors
:
...
...
@@ -167,14 +171,18 @@ class Downloads:
# Store only if the cache isn't available
if
self
.
_cache
is
None
:
with
open
(
self
.
_cache_file
,
"w"
)
as
f
:
json
.
dump
({
"config-hash"
:
self
.
_config_hash
,
"version"
:
CACHE_FILE_VERSION
,
"content"
:
{
"mirrors"
:
self
.
mirrors
,
"md5sums"
:
self
.
md5sums
,
json
.
dump
(
{
"config-hash"
:
self
.
_config_hash
,
"version"
:
CACHE_FILE_VERSION
,
"content"
:
{
"mirrors"
:
self
.
mirrors
,
"md5sums"
:
self
.
md5sums
,
},
},
},
f
,
separators
=
(
","
,
":"
))
f
,
separators
=
(
","
,
":"
),
)
# Invalidate the cache in this instance
delattr
(
self
,
"_cache_cache"
)
...
...
@@ -260,16 +268,19 @@ class Downloads:
torrent
=
"torrent"
in
flask
.
request
.
form
payload
=
signer
.
dumps
({
"url"
:
self
.
url_for
(
distro
,
release
,
arch
,
torrent
),
"md5"
:
self
.
md5sums
[
"%s:%s:%s"
%
(
distro
,
release
,
arch
)],
"name"
:
"%s %s%s"
%
(
self
.
config
[
"distros"
][
distro
][
"name"
],
self
.
config
[
"releases"
][
release
][
"version"
],
" LTS"
if
self
.
config
[
"releases"
][
release
][
"lts"
]
else
""
,
),
"theme"
:
distro
,
})
payload
=
signer
.
dumps
(
{
"url"
:
self
.
url_for
(
distro
,
release
,
arch
,
torrent
),
"md5"
:
self
.
md5sums
[
"%s:%s:%s"
%
(
distro
,
release
,
arch
)],
"name"
:
"%s %s%s"
%
(
self
.
config
[
"distros"
][
distro
][
"name"
],
self
.
config
[
"releases"
][
release
][
"version"
],
" LTS"
if
self
.
config
[
"releases"
][
release
][
"lts"
]
else
""
,
),
"theme"
:
distro
,
}
)
return
flask
.
redirect
(
flask
.
url_for
(
".thanks"
,
payload
=
payload
))
@
bp
.
route
(
"/grazie/<payload>"
)
...
...
@@ -287,10 +298,11 @@ class Downloads:
"""Generate the sub-navbar for /download"""
result
=
[]
for
name
,
distro
in
self
.
config
[
"distros"
].
items
():
result
.
append
({
"name"
:
distro
[
"name"
],
"endpoint"
:
"download.landing"
,
"endpoint-args"
:
{
"distro"
:
name
},
})
result
.
append
(
{
"name"
:
distro
[
"name"
],
"endpoint"
:
"download.landing"
,
"endpoint-args"
:
{
"distro"
:
name
},
}
)
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment