1
0
Fork 0

Update profile embeds, filter sensitive posts

This commit is contained in:
Daniel Supernault 2023-09-30 14:45:24 -06:00 committed by chris
parent 6cb17688c2
commit dcf0c9f371
1 changed files with 75 additions and 74 deletions

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ app()->getLocale() }}"> <html lang="{{ app()->getLocale() }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -16,8 +16,8 @@
<meta name="medium" content="image"> <meta name="medium" content="image">
<meta name="theme-color" content="#10c5f8"> <meta name="theme-color" content="#10c5f8">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<link rel="shortcut icon" type="image/png" href="/img/favicon.png?v=2"> <link rel="shortcut icon" type="image/png" href="{{url('/img/favicon.png?v=2')}}">
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2"> <link rel="apple-touch-icon" type="image/png" href="{{url('/img/favicon.png?v=2')}}">
<link href="{{ mix('css/app.css') }}" rel="stylesheet"> <link href="{{ mix('css/app.css') }}" rel="stylesheet">
<style type="text/css"> <style type="text/css">
body.embed-card { body.embed-card {
@ -29,89 +29,90 @@
box-shadow: none; box-shadow: none;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
} }
</style> </style>
</head> </head>
<body class="bg-white"> <body class="bg-white">
<div class="embed-card"> <div class="embed-card">
<div class="card status-card-embed card-md-rounded-0 border"> <div class="card status-card-embed card-md-rounded-0 border">
<div class="card-header d-inline-flex align-items-center justify-content-between bg-white"> <div class="card-header d-inline-flex align-items-center justify-content-between bg-white">
<div> <div>
<img src="{{$profile['avatar']}}" width="32px" height="32px" style="border-radius: 32px;"> <img src="{{$profile['avatar']}}" width="32px" height="32px" style="border-radius: 32px;">
<a class="username font-weight-bold pl-2 text-dark" target="_blank" href="{{$profile['url']}}"> <a class="username font-weight-bold pl-2 text-dark" target="_blank" href="{{$profile['url']}}">
{{$profile['username']}} {{$profile['username']}}
</a> </a>
</div> </div>
<div> <div>
<a class="small font-weight-bold text-muted pr-1" href="{{config('app.url')}}" target="_blank">{{config('pixelfed.domain.app')}}</a> <a class="small font-weight-bold text-muted pr-1" href="{{config('app.url')}}" target="_blank">{{config('pixelfed.domain.app')}}</a>
<img src="/img/pixelfed-icon-color.svg" width="26px"> <img src="/img/pixelfed-icon-color.svg" width="26px">
</div>
</div>
<div class="card-body pb-1">
<div class="d-flex justify-content-between align-items-center">
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount" data-count="{{$profile['statuses_count']}}"></p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Posts</p>
</div>
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount" data-count="{{$profile['followers_count']}}"></p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Followers</p>
</div>
<div class="text-center">
<p class="mb-0"><a href="/i/intent/follow?user={{$profile['username']}}" class="btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank">Follow</a></p>
</div>
</div>
<div class="row mt-4 mb-1 embed-row"></div>
</div>
<div class="card-footer bg-white">
<p class="text-center mb-0">
<a href="{{$profile['url']}}" class="font-weight-bold" target="_blank">View More Posts</a>
</p>
</div> </div>
</div>
<div class="card-body pb-1">
<div class="d-flex justify-content-between align-items-center">
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount" data-count="{{$profile['statuses_count']}}"></p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Posts</p>
</div> </div>
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount" data-count="{{$profile['followers_count']}}"></p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Followers</p>
</div> </div>
<script type="text/javascript" src="{{mix('js/manifest.js')}}"></script> <div class="text-center">
<script type="text/javascript" src="{{mix('js/vendor.js')}}"></script> <p class="mb-0"><a href="/i/intent/follow?user={{$profile['username']}}" class="btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank">Follow</a></p>
<script type="text/javascript" src="{{mix('js/app.js')}}"></script> </div>
<script type="text/javascript"> </div>
window.addEventListener("message", e=>{const t=e.data||{};}); <div class="row mt-4 mb-1 embed-row"></div>
</script> </div>
<script type="text/javascript">document.querySelectorAll('.caption-container a').forEach(function(i) {i.setAttribute('target', '_blank');});</script> <div class="card-footer bg-white">
<script type="text/javascript"> <p class="text-center mb-0">
<a href="{{$profile['url']}}" class="font-weight-bold" target="_blank">View More Posts</a>
</p>
</div>
</div>
</div>
<script type="text/javascript" src="{{mix('js/manifest.js')}}"></script>
<script type="text/javascript" src="{{mix('js/vendor.js')}}"></script>
<script type="text/javascript" src="{{mix('js/app.js')}}"></script>
<script type="text/javascript">
window.addEventListener("message", e=>{const t=e.data||{};});
</script>
<script type="text/javascript">document.querySelectorAll('.caption-container a').forEach(function(i) {i.setAttribute('target', '_blank');});</script>
<script type="text/javascript">
document.querySelectorAll('.prettyCount').forEach(function(i) { document.querySelectorAll('.prettyCount').forEach(function(i) {
i.innerText = App.util.format.count(i.getAttribute('data-count')); i.innerText = App.util.format.count(i.getAttribute('data-count'));
}); });
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
axios.get('/api/pixelfed/v1/accounts/{{$profile['id']}}/statuses', { axios.get('/api/pixelfed/v1/accounts/{{$profile['id']}}/statuses', {
params: { params: {
only_media: true, only_media: true,
limit: 20 limit: 24
} }
}) })
.then(res => { .then(res => {
let parent = $('.embed-row'); let parent = $('.embed-row');
res.data res.data
.filter(res => res.pf_type == 'photo') .filter(res => res.pf_type == 'photo')
.slice(0, 9) .filter(res => !res.sensitive)
.forEach(post => { .slice(0, 9)
let el = `<div class="col-4 mt-2 px-0"> .forEach(post => {
<a class="card info-overlay card-md-border-0 px-1 shadow-none" href="${post.url}" target="_blank"> let el = `<div class="col-4 mt-2 px-0">
<div class="square"> <a class="card info-overlay card-md-border-0 px-1 shadow-none" href="${post.url}" target="_blank">
<div class="square-content" style="background-image: url('${post.media_attachments[0].url}')"> <div class="square">
</div> <div class="square-content" style="background-image: url('${post.media_attachments[0].url}')">
</div> </div>
</a> </div>
</div>`; </a>
parent.append(el); </div>`;
}) parent.append(el);
}) })
.finally(() => { })
.finally(() => {
window.parent.postMessage({type:"setHeight",id:0,height:document.getElementsByTagName("html")[0].scrollHeight},"*");
setTimeout(() => {
window.parent.postMessage({type:"setHeight",id:0,height:document.getElementsByTagName("html")[0].scrollHeight},"*"); window.parent.postMessage({type:"setHeight",id:0,height:document.getElementsByTagName("html")[0].scrollHeight},"*");
setTimeout(() => { }, 5000);
window.parent.postMessage({type:"setHeight",id:0,height:document.getElementsByTagName("html")[0].scrollHeight},"*"); })
}, 5000); </script>
})
</script>
</body> </body>
</html> </html>