Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
8ea1367a
Commit
8ea1367a
authored
9 months ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
load images through proxy
parent
9a0de103
Branches
Branches containing commit
No related tags found
2 merge requests
!2246
Translated using Weblate (German)
,
!2244
Resolve "Rework Startpage"
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metager/app/Models/Tile.php
+11
-0
11 additions, 0 deletions
metager/app/Models/Tile.php
metager/resources/js/startpage/tiles.js
+1
-0
1 addition, 0 deletions
metager/resources/js/startpage/tiles.js
with
12 additions
and
0 deletions
metager/app/Models/Tile.php
+
11
−
0
View file @
8ea1367a
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
namespace
App\Models
;
namespace
App\Models
;
use
App\Http\Controllers\Pictureproxy
;
use
Exception
;
use
Request
;
/**
/**
* Model to hold data which represents a tile as visible on the startpage
* Model to hold data which represents a tile as visible on the startpage
*/
*/
...
@@ -25,6 +29,13 @@ class Tile implements \JsonSerializable
...
@@ -25,6 +29,13 @@ class Tile implements \JsonSerializable
public
function
__construct
(
string
$title
,
string
$image
,
string
$image_alt
,
string
$url
,
string
$classes
=
""
,
string
$image_classes
=
""
)
public
function
__construct
(
string
$title
,
string
$image
,
string
$image_alt
,
string
$url
,
string
$classes
=
""
,
string
$image_classes
=
""
)
{
{
$this
->
title
=
$title
;
$this
->
title
=
$title
;
try
{
$host
=
parse_url
(
$image
,
PHP_URL_HOST
);
if
(
$host
!==
null
&&
Request
::
host
()
!==
$host
)
{
$image
=
Pictureproxy
::
generateUrl
(
$image
);
}
}
catch
(
Exception
$e
)
{
}
$this
->
image
=
$image
;
$this
->
image
=
$image
;
$this
->
image_alt
=
$image_alt
;
$this
->
image_alt
=
$image_alt
;
$this
->
url
=
$url
;
$this
->
url
=
$url
;
...
...
This diff is collapsed.
Click to expand it.
metager/resources/js/startpage/tiles.js
+
1
−
0
View file @
8ea1367a
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
async
function
fetchAdvertisements
()
{
async
function
fetchAdvertisements
()
{
let
desired_tile_count
=
calculateDesiredTileCount
();
let
desired_tile_count
=
calculateDesiredTileCount
();
let
regular_tile_count
=
getRegularTileCount
();
let
regular_tile_count
=
getRegularTileCount
();
console
.
log
(
desired_tile_count
,
advertisements
.
length
)
if
(
advertisements
.
length
>=
desired_tile_count
-
regular_tile_count
)
return
;
if
(
advertisements
.
length
>=
desired_tile_count
-
regular_tile_count
)
return
;
let
update_url
=
document
.
querySelector
(
"
meta[name=tiles-update-url]
"
).
content
;
let
update_url
=
document
.
querySelector
(
"
meta[name=tiles-update-url]
"
).
content
;
update_url
+=
"
&count=
"
+
(
desired_tile_count
-
tile_count
);
update_url
+=
"
&count=
"
+
(
desired_tile_count
-
tile_count
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment