FIX: profile pictures not loading correctly, swiched to loading from link instead of filesystem
This commit is contained in:
parent
9e4e699499
commit
3967e543a0
|
@ -0,0 +1,2 @@
|
|||
src/resources/data.json
|
||||
src/public/img/profilepic.png
|
|
@ -30,18 +30,17 @@ services:
|
|||
image: nikurasukun/socialtree:latest
|
||||
volumes:
|
||||
- PATH/TO/CONFIG.json:/var/www/html/src/resources/data.json
|
||||
- PATH/TO/PROFILE/PICTURE.png:/var/www/html/src/public/img/profilepic.png
|
||||
ports:
|
||||
- "40890:80"
|
||||
```
|
||||
Mount your profile pic to `/var/www/html/src/resources/data.json` and the json with the config to
|
||||
`/var/www/html/src/public/img/profilepic.png`
|
||||
Mount a json with the config to `/var/www/html/src/resources/data.json`
|
||||
|
||||
It has to look like this
|
||||
```json
|
||||
{
|
||||
"username": "Nikurasu",
|
||||
"theme": "orange",
|
||||
"profilepicture": "https://link.to.profilepicture.com/image.png",
|
||||
"links": [{
|
||||
"platform": "Twitter",
|
||||
"link": "https://twitter.com/nik_png",
|
||||
|
@ -61,6 +60,9 @@ With `username` you specify the displayed name. The `theme` option specifies the
|
|||
themes are available:
|
||||
- `orange`
|
||||
|
||||
With `profilepicture` you specify the displayed profile picture. Upload it at the image hoster or cloud provider of your
|
||||
choice (imgur, imbb, Google Drive, nextcloud, etc.) and paste the direct link to the image here.
|
||||
|
||||
In the `links` array you can specify as many links as you want. The `platform` option is used for the coloring of the link.
|
||||
At the moment I support these platforms:
|
||||
- YouTube
|
||||
|
|
|
@ -26,4 +26,4 @@ RUN sed -ri -e "s/^DB_DATABASE=.*$/DB_DATABASE=\/var\/www\/html\/src\/resources\
|
|||
RUN sed -ri -e "s/^JSON_FILE_PATH=.*$/JSON_FILE_PATH=\/var\/www\/html\/src\/resources\/data.json/" /var/www/html/src/.env
|
||||
|
||||
EXPOSE 80
|
||||
CMD php src/artisan preloadDB:all && sapachectl -D FOREGROUND
|
||||
CMD php src/artisan preloadDB:all && apachectl -D FOREGROUND
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace App\Models{
|
|||
* @property int $id
|
||||
* @property string $username
|
||||
* @property string $theme
|
||||
* @property string $profilepicture
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Userdata newModelQuery()
|
||||
|
|
|
@ -49,9 +49,10 @@ class PreloadDBAll extends Command
|
|||
if (
|
||||
array_key_exists('username', $config) &&
|
||||
array_key_exists('links', $config) &&
|
||||
array_key_exists('profilepicture', $config) &&
|
||||
array_key_exists('theme', $config)
|
||||
) {
|
||||
$preloadDBController->setInitialUserData($config['username'], $config['theme']);
|
||||
$preloadDBController->setInitialUserData($config['username'], $config['theme'], $config['profilepicture']);
|
||||
$arrayHasAllKeys = true;
|
||||
foreach ($config['links'] as $link)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ class PreloadDBController extends Controller
|
|||
$this->linksService = new LinksService();
|
||||
}
|
||||
|
||||
public function setInitialUserData(string $username, string $theme)
|
||||
public function setInitialUserData(string $username, string $theme, string $profilepicture)
|
||||
{
|
||||
$userdatas = $this->userdatasService->getAllUserdatas();
|
||||
$userdataslenght = count($userdatas);
|
||||
|
@ -29,7 +29,7 @@ class PreloadDBController extends Controller
|
|||
$this->userdatasService->deleteUserdataByID($userdatas[$userdata]['id']);
|
||||
}
|
||||
}
|
||||
$this->userdatasService->setNewUserdata($username, $theme);
|
||||
$this->userdatasService->setNewUserdata($username, $theme, $profilepicture);
|
||||
}
|
||||
|
||||
public function setInitialLinks(array $newlinks)
|
||||
|
|
|
@ -23,11 +23,13 @@ class SocialTreePageController extends Controller
|
|||
$userdata = $this->userdatasService->getFirstUserdata();
|
||||
$username = $userdata['username'];
|
||||
$theme = $userdata['theme'];
|
||||
$profilepicture = $userdata['profilepicture'];
|
||||
return view('app',[
|
||||
'title' => $username . 's LinkTree',
|
||||
'username' => $username,
|
||||
'links' => $links,
|
||||
'theme' => $theme,
|
||||
'profilepicture' => $profilepicture,
|
||||
'content' => 'linkpage'
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int $id
|
||||
* @property string $username
|
||||
* @property string $theme
|
||||
* @property string $profilepicture
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Userdata newModelQuery()
|
||||
|
@ -29,6 +30,7 @@ class Userdata extends Model
|
|||
protected $table = 'userdatas';
|
||||
protected $attributes = [
|
||||
'username'=> 'null',
|
||||
'theme'=> 'orange'
|
||||
'theme'=> 'orange',
|
||||
'profilepicture' => 'https://upload.wikimedia.org/wikipedia/commons/a/ac/Default_pfp.jpg',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@ use App\Models\Userdata;
|
|||
|
||||
class UserdataDataMutator
|
||||
{
|
||||
public function setNewUserdata(string $username, string $theme): bool
|
||||
public function setNewUserdata(string $username, string $theme, string $profilepicture): bool
|
||||
{
|
||||
$userdata = new Userdata();
|
||||
$userdata->username = $username;
|
||||
$userdata->theme = $theme;
|
||||
$userdata->profilepicture = $profilepicture;
|
||||
return $userdata->save();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ class UserdatasService
|
|||
return count($this->userdatasDataProvider->getAllUserdatas());
|
||||
}
|
||||
|
||||
public function setNewUserdata(string $username, string $theme)
|
||||
public function setNewUserdata(string $username, string $theme, string $profilepicture)
|
||||
{
|
||||
return $this->userdatasDataMutator->setNewUserdata($username, $theme);
|
||||
return $this->userdatasDataMutator->setNewUserdata($username, $theme, $profilepicture);
|
||||
}
|
||||
|
||||
public function deleteUserdataByID(int $id)
|
||||
|
|
|
@ -17,6 +17,7 @@ class CreateUserdatasTable extends Migration
|
|||
$table->id();
|
||||
$table->string('username');
|
||||
$table->string('theme');
|
||||
$table->string('profilepicture');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 326 KiB |
|
@ -1,5 +1,5 @@
|
|||
<div class="linkpage">
|
||||
<img src="{{asset('img/profilepic.png')}}">
|
||||
<img src="{{$profilepicture}}">
|
||||
<p class="username">@{{$username}}</p>
|
||||
<div class="links">
|
||||
@foreach($links as $link)
|
||||
|
|
Reference in New Issue