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
Show 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:
...
@@ -64,9 +64,13 @@ class Downloads:
else
:
else
:
self
.
_mirrors
=
{}
self
.
_mirrors
=
{}
for
distro
in
self
.
config
[
"mirrors"
][
"for"
]:
for
distro
in
self
.
config
[
"mirrors"
][
"for"
]:
found_mirrors
=
list
(
sorted
(
launchpad
.
get_cdimage_mirrors
(
found_mirrors
=
list
(
sorted
(
launchpad
.
get_cdimage_mirrors
(
distro
,
self
.
config
[
"mirrors"
][
"country"
]
distro
,
self
.
config
[
"mirrors"
][
"country"
]
)))
)
)
)
if
found_mirrors
:
if
found_mirrors
:
self
.
_mirrors
[
distro
]
=
found_mirrors
self
.
_mirrors
[
distro
]
=
found_mirrors
if
not
self
.
_mirrors
:
if
not
self
.
_mirrors
:
...
@@ -167,14 +171,18 @@ class Downloads:
...
@@ -167,14 +171,18 @@ class Downloads:
# Store only if the cache isn't available
# Store only if the cache isn't available
if
self
.
_cache
is
None
:
if
self
.
_cache
is
None
:
with
open
(
self
.
_cache_file
,
"w"
)
as
f
:
with
open
(
self
.
_cache_file
,
"w"
)
as
f
:
json
.
dump
({
json
.
dump
(
{
"config-hash"
:
self
.
_config_hash
,
"config-hash"
:
self
.
_config_hash
,
"version"
:
CACHE_FILE_VERSION
,
"version"
:
CACHE_FILE_VERSION
,
"content"
:
{
"content"
:
{
"mirrors"
:
self
.
mirrors
,
"mirrors"
:
self
.
mirrors
,
"md5sums"
:
self
.
md5sums
,
"md5sums"
:
self
.
md5sums
,
},
},
},
f
,
separators
=
(
","
,
":"
))
},
f
,
separators
=
(
","
,
":"
),
)
# Invalidate the cache in this instance
# Invalidate the cache in this instance
delattr
(
self
,
"_cache_cache"
)
delattr
(
self
,
"_cache_cache"
)
...
@@ -260,16 +268,19 @@ class Downloads:
...
@@ -260,16 +268,19 @@ class Downloads:
torrent
=
"torrent"
in
flask
.
request
.
form
torrent
=
"torrent"
in
flask
.
request
.
form
payload
=
signer
.
dumps
({
payload
=
signer
.
dumps
(
{
"url"
:
self
.
url_for
(
distro
,
release
,
arch
,
torrent
),
"url"
:
self
.
url_for
(
distro
,
release
,
arch
,
torrent
),
"md5"
:
self
.
md5sums
[
"%s:%s:%s"
%
(
distro
,
release
,
arch
)],
"md5"
:
self
.
md5sums
[
"%s:%s:%s"
%
(
distro
,
release
,
arch
)],
"name"
:
"%s %s%s"
%
(
"name"
:
"%s %s%s"
%
(
self
.
config
[
"distros"
][
distro
][
"name"
],
self
.
config
[
"distros"
][
distro
][
"name"
],
self
.
config
[
"releases"
][
release
][
"version"
],
self
.
config
[
"releases"
][
release
][
"version"
],
" LTS"
if
self
.
config
[
"releases"
][
release
][
"lts"
]
else
""
,
" LTS"
if
self
.
config
[
"releases"
][
release
][
"lts"
]
else
""
,
),
),
"theme"
:
distro
,
"theme"
:
distro
,
})
}
)
return
flask
.
redirect
(
flask
.
url_for
(
".thanks"
,
payload
=
payload
))
return
flask
.
redirect
(
flask
.
url_for
(
".thanks"
,
payload
=
payload
))
@
bp
.
route
(
"/grazie/<payload>"
)
@
bp
.
route
(
"/grazie/<payload>"
)
...
@@ -287,10 +298,11 @@ class Downloads:
...
@@ -287,10 +298,11 @@ class Downloads:
"""Generate the sub-navbar for /download"""
"""Generate the sub-navbar for /download"""
result
=
[]
result
=
[]
for
name
,
distro
in
self
.
config
[
"distros"
].
items
():
for
name
,
distro
in
self
.
config
[
"distros"
].
items
():
result
.
append
({
result
.
append
(
{
"name"
:
distro
[
"name"
],
"name"
:
distro
[
"name"
],
"endpoint"
:
"download.landing"
,
"endpoint"
:
"download.landing"
,
"endpoint-args"
:
{
"distro"
:
name
},
"endpoint-args"
:
{
"distro"
:
name
},
})
}
)
return
result
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