diff --git a/CHANGELOG.md b/CHANGELOG.md index 949a88602..7c01b7379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.9...dev) ### Added +- Custom content warnings for remote posts ([6afc61a4](https://github.com/pixelfed/pixelfed/commit/6afc61a4)) ### Updated - Updated PostComponent, fix remote urls ([42716ccc](https://github.com/pixelfed/pixelfed/commit/42716ccc)) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 8ed3be375..adcb32dee 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -552,6 +552,7 @@ class PublicApiController extends Controller 'reblogs_count', 'scope', 'local', + 'cw_summary', 'created_at', 'updated_at' )->whereProfileId($profile->id) diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index af46fee5e..ba3517314 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -327,6 +327,8 @@ class Helpers { $status->is_nsfw = $cw; $status->scope = $scope; $status->visibility = $scope; + $status->cw_summary = $cw == true && isset($res['summary']) ? + Purify::clean(strip_tags($res['summary'])) : null; $status->save(); if($reply_to == null) { self::importNoteAttachment($res, $status); @@ -404,7 +406,8 @@ class Helpers { if(empty($username)) { return; } - $remoteUsername = "@{$username}@{$domain}"; + $remoteUsername = $username; + $webfinger = "@{$username}@{$domain}"; abort_if(!self::validateUrl($res['inbox']), 400); abort_if(!self::validateUrl($res['id']), 400); @@ -422,6 +425,8 @@ class Helpers { $profile->remote_url = strtolower($res['id']); $profile->public_key = $res['publicKey']['publicKeyPem']; $profile->key_id = $res['publicKey']['id']; + $profile->webfinger = strtolower(Purify::clean($webfinger)); + $profile->last_fetched_at = now(); $profile->save(); if($runJobs == true) { // RemoteFollowImportRecent::dispatch($res, $profile); diff --git a/public/js/rempro.js b/public/js/rempro.js index 87e98ae6a..811a6e606 100644 --- a/public/js/rempro.js +++ b/public/js/rempro.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{"+GUX":function(t,e,i){Vue.component("remote-profile",i("9Y9R").default)},21:function(t,e,i){t.exports=i("+GUX")},"9Y9R":function(t,e,i){"use strict";i.r(e);function n(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e0})).map((function(t){return{id:t.id,caption:{text:t.content_text,html:t.content},count:{likes:t.favourites_count,shares:t.reblogs_count,comments:t.reply_count},thumb:t.media_attachments[0].preview_url,media:t.media_attachments,timestamp:t.created_at,type:t.pf_type,url:t.url,sensitive:t.sensitive,cw:t.sensitive}})),o=i.map((function(t){return t.id}));t.ids=o,t.min_id=Math.max.apply(Math,n(o)),t.max_id=Math.min.apply(Math,n(o)),t.feed=i,t.loading=!1})).catch((function(t){swal("Oops, something went wrong","Please release the page.","error")}))},fetchRelationships:function(){var t=this;0!=document.querySelectorAll("body")[0].classList.contains("loggedIn")&&axios.get("/api/pixelfed/v1/accounts/relationships",{params:{"id[]":this.profileId}}).then((function(e){e.data.length&&(t.relationship=e.data[0],1==e.data[0].blocking&&(t.loading=!1,t.warning=!0))}))},postPreviewUrl:function(t){return'background: url("'+t.thumb+'");background-size:cover'},timestampFormat:function(t){var e=new Date(t);return e.toDateString()+" "+e.toLocaleTimeString()},remoteProfileUrl:function(t){return"/i/web/profile/_/"+t.id},remotePostUrl:function(t){return"/i/web/post/_/"+this.profile.id+"/"+t.id},followProfile:function(){var t=this;axios.post("/i/follow",{item:this.profileId}).then((function(e){swal("Followed","You are now following "+t.profile.username+"!","success"),t.relationship.following=!0})).catch((function(t){swal("Oops!","Something went wrong, please try again later.","error")}))},unfollowProfile:function(){var t=this;axios.post("/i/follow",{item:this.profileId}).then((function(e){swal("Unfollowed","You are no longer following "+t.profile.username+".","warning"),t.relationship.following=!1})).catch((function(t){swal("Oops!","Something went wrong, please try again later.","error")}))},showCtxMenu:function(){this.$refs.visitorContextMenu.show()},copyProfileLink:function(){navigator.clipboard.writeText(window.location.href),this.$refs.visitorContextMenu.hide()},muteProfile:function(){var t=this,e=this.profileId;axios.post("/i/mute",{type:"user",item:e}).then((function(e){t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully muted "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},unmuteProfile:function(){var t=this,e=this.profileId;axios.post("/i/unmute",{type:"user",item:e}).then((function(e){t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully unmuted "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},blockProfile:function(){var t=this,e=this.profileId;axios.post("/i/block",{type:"user",item:e}).then((function(e){t.warning=!0,t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully blocked "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},unblockProfile:function(){var t=this,e=this.profileId;axios.post("/i/unblock",{type:"user",item:e}).then((function(e){t.warning=!1,t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully unblocked "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},reportProfile:function(){window.location.href="/l/i/report?type=profile&id="+this.profileId,this.$refs.visitorContextMenu.hide()},ctxMenu:function(t){this.ctxMenuStatus=t;var e=this;axios.get("/api/pixelfed/v1/accounts/relationships",{params:{"id[]":e.profileId}}).then((function(t){e.ctxMenuRelationship=t.data[0],e.$refs.ctxModal.show()}))},closeCtxMenu:function(){this.ctxMenuStatus=!1,this.ctxMenuRelationship=!1,this.$refs.ctxModal.hide()},ctxMenuCopyLink:function(){var t=this.ctxMenuStatus;navigator.clipboard.writeText(t.url),this.closeCtxMenu()},ctxMenuGoToPost:function(){var t=this.ctxMenuStatus;window.location.href=this.statusUrl(t),this.closeCtxMenu()},statusUrl:function(t){return"/i/web/post/_/"+this.profile.id+"/"+t.id},deletePost:function(t){var e=this;0!=this.user.is_admin&&0!=window.confirm("Are you sure you want to delete this post?")&&axios.post("/i/delete",{type:"status",item:t.id}).then((function(i){e.feed=e.feed.filter((function(e){return e.id!=t.id})),e.$refs.ctxModal.hide()})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")}))}}},r=(i("djXL"),i("KHd+")),s=Object(r.a)(o,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t.relationship&&t.relationship.blocking&&t.warning?i("div",{staticClass:"bg-white pt-3 border-bottom"},[i("div",{staticClass:"container"},[i("p",{staticClass:"text-center font-weight-bold"},[t._v("You are blocking this account")]),t._v(" "),i("p",{staticClass:"text-center font-weight-bold"},[t._v("Click "),i("a",{staticClass:"cursor-pointer",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.warning=!1}}},[t._v("here")]),t._v(" to view profile")])])]):t._e(),t._v(" "),t.loading?i("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"80vh"}},[i("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]):t._e(),t._v(" "),t.loading||t.warning?t._e():i("div",{staticClass:"container"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12 col-md-4 pt-5"},[i("div",{staticClass:"card shadow-none border"},[i("div",{staticClass:"card-header p-0 m-0"},[t.profile.header_bg?i("img",{staticStyle:{width:"100%",height:"140px","object-fit":"cover"},attrs:{src:t.profile.header_bg}}):i("div",{staticClass:"bg-primary",staticStyle:{width:"100%",height:"140px"}})]),t._v(" "),i("div",{staticClass:"card-body pb-0"},[i("div",{staticClass:"mt-n5 mb-3"},[i("img",{staticClass:"rounded-circle p-1 border mt-n4 bg-white shadow",attrs:{src:t.profile.avatar,width:"90px",height:"90px;"}}),t._v(" "),i("span",{staticClass:"float-right mt-n1"},[i("span",[t.relationship&&0==t.relationship.following?i("button",{staticClass:"btn btn-outline-light py-0 px-3 mt-n1",staticStyle:{"font-size":"13px","font-weight":"500"},on:{click:function(e){return t.followProfile()}}},[t._v("Follow")]):t._e(),t._v(" "),t.relationship&&1==t.relationship.following?i("button",{staticClass:"btn btn-outline-light py-0 px-3 mt-n1",staticStyle:{"font-size":"13px","font-weight":"500"},on:{click:function(e){return t.unfollowProfile()}}},[t._v("Unfollow")]):t._e()]),t._v(" "),i("span",{staticClass:"ml-3"},[i("button",{staticClass:"btn btn-outline-light btn-sm mt-n1",staticStyle:{"padding-top":"2px","padding-bottom":"1px"},on:{click:function(e){return t.showCtxMenu()}}},[i("i",{staticClass:"fas fa-cog cursor-pointer",staticStyle:{"font-size":"13px"}})])])])]),t._v(" "),i("p",{staticClass:"pl-2 h4 font-weight-bold mb-1"},[t._v(t._s(t.profile.display_name))]),t._v(" "),i("p",{staticClass:"pl-2 font-weight-bold mb-1 text-muted"},[t._v(t._s(t.profile.acct))]),t._v(" "),i("p",{staticClass:"pl-2 text-muted small pt-3",domProps:{innerHTML:t._s(t.profile.note)}}),t._v(" "),i("p",{staticClass:"pl-2 text-muted small d-flex justify-content-between"},[i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.statuses_count))]),t._v(" "),i("span",[t._v("Posts")])]),t._v(" "),i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.following_count))]),t._v(" "),i("span",[t._v("Following")])]),t._v(" "),i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.followers_count))]),t._v(" "),i("span",[t._v("Followers")])])])])])]),t._v(" "),i("div",{staticClass:"col-12 col-md-8 pt-5"},[i("div",{staticClass:"row"},t._l(t.feed,(function(e,n){return i("div",{key:"remprop"+n,staticClass:"col-12 mb-2"},[i("div",{staticClass:"card mb-sm-4 status-card card-md-rounded-0 shadow-none border cursor-pointer"},[i("div",{staticClass:"card-header d-inline-flex align-items-center bg-white"},[i("img",{staticStyle:{"border-radius":"38px"},attrs:{src:t.profile.avatar,width:"38px",height:"38px",onerror:"this.onerror=null;this.src='/storage/avatars/default.png?v=2'"}}),t._v(" "),i("div",{staticClass:"pl-2"},[i("span",{staticClass:"username font-weight-bold text-dark"},[t._v(t._s(t.profile.username)+"\n\t\t\t\t\t\t\t\t\t\t")])]),t._v(" "),i("div",{staticClass:"text-right",staticStyle:{"flex-grow":"1"}},[i("button",{staticClass:"btn btn-link text-dark py-0",attrs:{type:"button"},on:{click:function(i){return t.ctxMenu(e)}}},[i("span",{staticClass:"fas fa-ellipsis-h text-lighter"})])])]),t._v(" "),i("div",{staticClass:"card-body p-0"},[1==e.sensitive?i("div",[i("details",{staticClass:"details-animated",on:{click:function(t){e.sensitive=!1}}},[t._m(0,!0),t._v(" "),i("a",{attrs:{href:e.url}},[t._o(i("img",{staticClass:"w-100 h-100",attrs:{src:e.thumb}}),0,"remprop"+n)])])]):i("div",[i("a",{attrs:{href:e.url}},[t._o(i("img",{staticClass:"w-100 h-100",attrs:{src:e.thumb}}),1,"remprop"+n)]),t._v(" "),1==e.cw&&0==e.sensitive?i("button",{staticClass:"btn btn-block btn-primary font-weight-bold rounded-0",on:{click:function(t){e.sensitive=!0}}},[t._v("Hide Media")]):t._e()])]),t._v(" "),i("div",{staticClass:"card-body"},[i("div",{staticClass:"caption"},[i("p",{staticClass:"mb-2 read-more",staticStyle:{overflow:"hidden"}},[i("span",{staticClass:"username font-weight-bold"},[i("bdi",[i("span",{staticClass:"text-dark"},[t._v(t._s(t.profile.username))])])]),t._v(" "),i("span",{staticClass:"status-content",domProps:{innerHTML:t._s(e.caption.html)}})])]),t._v(" "),i("div",{staticClass:"timestamp mt-2"},[i("p",{staticClass:"small text-uppercase mb-0"},[i("a",{staticClass:"text-muted",attrs:{href:t.remotePostUrl(e)}},[i("timeago",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover.bottom",modifiers:{hover:!0,bottom:!0}}],attrs:{datetime:e.timestamp,"auto-update":90,"converter-options":{includeSeconds:!0},title:t.timestampFormat(e.timestamp)}})],1)])])])])])})),0)])]),t._v(" "),i("b-modal",{ref:"visitorContextMenu",attrs:{id:"visitor-context-menu","hide-footer":"","hide-header":"",centered:"",size:"sm","body-class":"list-group-flush p-0"}},[t.relationship?i("div",{staticClass:"list-group"},[i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.copyProfileLink}},[t._v("\n\t\t\t\t\tCopy Link\n\t\t\t\t")]),t._v(" "),!t.user||t.owner||t.relationship.muting?t._e():i("div",{staticClass:"list-group-item cursor-pointer text-center rounded",on:{click:t.muteProfile}},[t._v("\n\t\t\t\t\tMute\n\t\t\t\t")]),t._v(" "),t.user&&!t.owner&&t.relationship.muting?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded",on:{click:t.unmuteProfile}},[t._v("\n\t\t\t\t\tUnmute\n\t\t\t\t")]):t._e(),t._v(" "),t.user&&!t.owner?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.reportProfile}},[t._v("\n\t\t\t\t\tReport User\n\t\t\t\t")]):t._e(),t._v(" "),!t.user||t.owner||t.relationship.blocking?t._e():i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.blockProfile}},[t._v("\n\t\t\t\t\tBlock\n\t\t\t\t")]),t._v(" "),t.user&&!t.owner&&t.relationship.blocking?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.unblockProfile}},[t._v("\n\t\t\t\t\tUnblock\n\t\t\t\t")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-muted",on:{click:function(e){return t.$refs.visitorContextMenu.hide()}}},[t._v("\n\t\t\t\t\tClose\n\t\t\t\t")])]):t._e()]),t._v(" "),i("b-modal",{ref:"ctxModal",attrs:{id:"ctx-modal","hide-header":"","hide-footer":"",centered:"",rounded:"",size:"sm","body-class":"list-group-flush p-0 rounded"}},[i("div",{staticClass:"list-group text-center"},[t.ctxMenuStatus&&t.profile.id!=t.profile.id?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-danger",on:{click:function(e){return t.ctxMenuReportPost()}}},[t._v("Report inappropriate")]):t._e(),t._v(" "),t.ctxMenuStatus&&t.profile.id!=t.profile.id&&t.ctxMenuRelationship&&t.ctxMenuRelationship.following?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-danger",on:{click:function(e){return t.ctxMenuUnfollow()}}},[t._v("Unfollow")]):t._e(),t._v(" "),t.ctxMenuStatus&&t.profile.id!=t.profile.id&&t.ctxMenuRelationship&&!t.ctxMenuRelationship.following?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-primary",on:{click:function(e){return t.ctxMenuFollow()}}},[t._v("Follow")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxMenuGoToPost()}}},[t._v("Go to post")]),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxMenuCopyLink()}}},[t._v("Copy Link")]),t._v(" "),t.profile&&1==t.profile.is_admin?i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxModMenuShow()}}},[t._v("Moderation Tools")]):t._e(),t._v(" "),t.ctxMenuStatus&&(t.profile.is_admin||t.profile.id==t.profile.id)?i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.deletePost(t.ctxMenuStatus)}}},[t._v("Delete")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer text-lighter",on:{click:function(e){return t.closeCtxMenu()}}},[t._v("Cancel")])])])],1)])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("summary",[e("p",{staticClass:"mb-0 lead font-weight-bold"},[this._v("CW / NSFW / Hidden Media")]),this._v(" "),e("p",{staticClass:"font-weight-light"},[this._v("(click to show)")])])}],!1,null,"7a23ca4c",null);e.default=s.exports},"9tPo":function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=function(t,e){var i=t[1]||"",n=t[3];if(!n)return i;if(e&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=n.sources.map((function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"}));return[i].concat(r).concat([o]).join("\n")}var s;return[i].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i})).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o=0&&d.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var n=function(){0;return i.nc}();n&&(t.attrs.nonce=n)}return w(e,t.attrs),v(t,e),e}function w(t,e){Object.keys(e).forEach((function(i){t.setAttribute(i,e[i])}))}function _(t,e){var i,n,o,r;if(e.transform&&t.css){if(!(r="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=r}if(e.singleton){var s=u++;i=l||(l=g(e)),n=C.bind(null,i,s,!1),o=C.bind(null,i,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",w(e,t.attrs),v(t,e),e}(e),n=M.bind(null,i,e),o=function(){m(i),i.href&&URL.revokeObjectURL(i.href)}):(i=g(e),n=y.bind(null,i),o=function(){m(i)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var i=h(t,e);return p(i,e),function(t){for(var n=[],o=0;o0})).map((function(t){return{id:t.id,caption:{text:t.content_text,html:t.content},count:{likes:t.favourites_count,shares:t.reblogs_count,comments:t.reply_count},thumb:t.media_attachments[0].preview_url,media:t.media_attachments,timestamp:t.created_at,type:t.pf_type,url:t.url,sensitive:t.sensitive,cw:t.sensitive,spoiler_text:t.spoiler_text}})),o=i.map((function(t){return t.id}));t.ids=o,t.min_id=Math.max.apply(Math,n(o)),t.max_id=Math.min.apply(Math,n(o)),t.feed=i,t.loading=!1})).catch((function(t){swal("Oops, something went wrong","Please release the page.","error")}))},fetchRelationships:function(){var t=this;0!=document.querySelectorAll("body")[0].classList.contains("loggedIn")&&axios.get("/api/pixelfed/v1/accounts/relationships",{params:{"id[]":this.profileId}}).then((function(e){e.data.length&&(t.relationship=e.data[0],1==e.data[0].blocking&&(t.loading=!1,t.warning=!0))}))},postPreviewUrl:function(t){return'background: url("'+t.thumb+'");background-size:cover'},timestampFormat:function(t){var e=new Date(t);return e.toDateString()+" "+e.toLocaleTimeString()},remoteProfileUrl:function(t){return"/i/web/profile/_/"+t.id},remotePostUrl:function(t){return"/i/web/post/_/"+this.profile.id+"/"+t.id},followProfile:function(){var t=this;axios.post("/i/follow",{item:this.profileId}).then((function(e){swal("Followed","You are now following "+t.profile.username+"!","success"),t.relationship.following=!0})).catch((function(t){swal("Oops!","Something went wrong, please try again later.","error")}))},unfollowProfile:function(){var t=this;axios.post("/i/follow",{item:this.profileId}).then((function(e){swal("Unfollowed","You are no longer following "+t.profile.username+".","warning"),t.relationship.following=!1})).catch((function(t){swal("Oops!","Something went wrong, please try again later.","error")}))},showCtxMenu:function(){this.$refs.visitorContextMenu.show()},copyProfileLink:function(){navigator.clipboard.writeText(window.location.href),this.$refs.visitorContextMenu.hide()},muteProfile:function(){var t=this,e=this.profileId;axios.post("/i/mute",{type:"user",item:e}).then((function(e){t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully muted "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},unmuteProfile:function(){var t=this,e=this.profileId;axios.post("/i/unmute",{type:"user",item:e}).then((function(e){t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully unmuted "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},blockProfile:function(){var t=this,e=this.profileId;axios.post("/i/block",{type:"user",item:e}).then((function(e){t.warning=!0,t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully blocked "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},unblockProfile:function(){var t=this,e=this.profileId;axios.post("/i/unblock",{type:"user",item:e}).then((function(e){t.warning=!1,t.fetchRelationships(),t.$refs.visitorContextMenu.hide(),swal("Success","You have successfully unblocked "+t.profile.acct,"success")})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")})),this.$refs.visitorContextMenu.hide()},reportProfile:function(){window.location.href="/l/i/report?type=profile&id="+this.profileId,this.$refs.visitorContextMenu.hide()},ctxMenu:function(t){this.ctxMenuStatus=t;var e=this;axios.get("/api/pixelfed/v1/accounts/relationships",{params:{"id[]":e.profileId}}).then((function(t){e.ctxMenuRelationship=t.data[0],e.$refs.ctxModal.show()}))},closeCtxMenu:function(){this.ctxMenuStatus=!1,this.ctxMenuRelationship=!1,this.$refs.ctxModal.hide()},ctxMenuCopyLink:function(){var t=this.ctxMenuStatus;navigator.clipboard.writeText(t.url),this.closeCtxMenu()},ctxMenuGoToPost:function(){var t=this.ctxMenuStatus;window.location.href=this.statusUrl(t),this.closeCtxMenu()},statusUrl:function(t){return"/i/web/post/_/"+this.profile.id+"/"+t.id},deletePost:function(t){var e=this;0!=this.user.is_admin&&0!=window.confirm("Are you sure you want to delete this post?")&&axios.post("/i/delete",{type:"status",item:t.id}).then((function(i){e.feed=e.feed.filter((function(e){return e.id!=t.id})),e.$refs.ctxModal.hide()})).catch((function(t){swal("Error","Something went wrong. Please try again later.","error")}))}}},r=(i("T4YL"),i("KHd+")),s=Object(r.a)(o,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t.relationship&&t.relationship.blocking&&t.warning?i("div",{staticClass:"bg-white pt-3 border-bottom"},[i("div",{staticClass:"container"},[i("p",{staticClass:"text-center font-weight-bold"},[t._v("You are blocking this account")]),t._v(" "),i("p",{staticClass:"text-center font-weight-bold"},[t._v("Click "),i("a",{staticClass:"cursor-pointer",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.warning=!1}}},[t._v("here")]),t._v(" to view profile")])])]):t._e(),t._v(" "),t.loading?i("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"80vh"}},[i("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]):t._e(),t._v(" "),t.loading||t.warning?t._e():i("div",{staticClass:"container"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12 col-md-4 pt-5"},[i("div",{staticClass:"card shadow-none border"},[i("div",{staticClass:"card-header p-0 m-0"},[t.profile.header_bg?i("img",{staticStyle:{width:"100%",height:"140px","object-fit":"cover"},attrs:{src:t.profile.header_bg}}):i("div",{staticClass:"bg-primary",staticStyle:{width:"100%",height:"140px"}})]),t._v(" "),i("div",{staticClass:"card-body pb-0"},[i("div",{staticClass:"mt-n5 mb-3"},[i("img",{staticClass:"rounded-circle p-1 border mt-n4 bg-white shadow",attrs:{src:t.profile.avatar,width:"90px",height:"90px;"}}),t._v(" "),i("span",{staticClass:"float-right mt-n1"},[i("span",[t.relationship&&0==t.relationship.following?i("button",{staticClass:"btn btn-outline-light py-0 px-3 mt-n1",staticStyle:{"font-size":"13px","font-weight":"500"},on:{click:function(e){return t.followProfile()}}},[t._v("Follow")]):t._e(),t._v(" "),t.relationship&&1==t.relationship.following?i("button",{staticClass:"btn btn-outline-light py-0 px-3 mt-n1",staticStyle:{"font-size":"13px","font-weight":"500"},on:{click:function(e){return t.unfollowProfile()}}},[t._v("Unfollow")]):t._e()]),t._v(" "),i("span",{staticClass:"ml-3"},[i("button",{staticClass:"btn btn-outline-light btn-sm mt-n1",staticStyle:{"padding-top":"2px","padding-bottom":"1px"},on:{click:function(e){return t.showCtxMenu()}}},[i("i",{staticClass:"fas fa-cog cursor-pointer",staticStyle:{"font-size":"13px"}})])])])]),t._v(" "),i("p",{staticClass:"pl-2 h4 font-weight-bold mb-1"},[t._v(t._s(t.profile.display_name))]),t._v(" "),i("p",{staticClass:"pl-2 font-weight-bold mb-1 text-muted"},[t._v(t._s(t.profile.acct))]),t._v(" "),i("p",{staticClass:"pl-2 text-muted small pt-3",domProps:{innerHTML:t._s(t.profile.note)}}),t._v(" "),i("p",{staticClass:"pl-2 text-muted small d-flex justify-content-between"},[i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.statuses_count))]),t._v(" "),i("span",[t._v("Posts")])]),t._v(" "),i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.following_count))]),t._v(" "),i("span",[t._v("Following")])]),t._v(" "),i("span",[i("span",{staticClass:"font-weight-bold text-dark"},[t._v(t._s(t.profile.followers_count))]),t._v(" "),i("span",[t._v("Followers")])])])])])]),t._v(" "),i("div",{staticClass:"col-12 col-md-8 pt-5"},[i("div",{staticClass:"row"},t._l(t.feed,(function(e,n){return i("div",{key:"remprop"+n,staticClass:"col-12 mb-2"},[i("div",{staticClass:"card mb-sm-4 status-card card-md-rounded-0 shadow-none border cursor-pointer"},[i("div",{staticClass:"card-header d-inline-flex align-items-center bg-white"},[i("img",{staticStyle:{"border-radius":"38px"},attrs:{src:t.profile.avatar,width:"38px",height:"38px",onerror:"this.onerror=null;this.src='/storage/avatars/default.png?v=2'"}}),t._v(" "),i("div",{staticClass:"pl-2"},[i("span",{staticClass:"username font-weight-bold text-dark"},[t._v(t._s(t.profile.username)+"\n\t\t\t\t\t\t\t\t\t\t")])]),t._v(" "),i("div",{staticClass:"text-right",staticStyle:{"flex-grow":"1"}},[i("button",{staticClass:"btn btn-link text-dark py-0",attrs:{type:"button"},on:{click:function(i){return t.ctxMenu(e)}}},[i("span",{staticClass:"fas fa-ellipsis-h text-lighter"})])])]),t._v(" "),i("div",{staticClass:"card-body p-0"},[1==e.sensitive?i("div",[i("details",{staticClass:"details-animated",on:{click:function(t){e.sensitive=!1}}},[i("summary",[i("p",{staticClass:"mb-0 lead font-weight-bold"},[t._v(t._s(e.spoiler_text?e.spoiler_text:"CW / NSFW / Hidden Media"))]),t._v(" "),i("p",{staticClass:"font-weight-light"},[t._v("(click to show)")])]),t._v(" "),i("a",{attrs:{href:t.remotePostUrl(e)}},[t._o(i("img",{staticClass:"w-100 h-100",attrs:{src:e.thumb}}),0,"remprop"+n)])])]):i("div",[i("a",{attrs:{href:t.remotePostUrl(e)}},[t._o(i("img",{staticClass:"w-100 h-100",attrs:{src:e.thumb}}),1,"remprop"+n)]),t._v(" "),1==e.cw&&0==e.sensitive?i("button",{staticClass:"btn btn-block btn-primary font-weight-bold rounded-0",on:{click:function(t){e.sensitive=!0}}},[t._v("Hide Media")]):t._e()])]),t._v(" "),i("div",{staticClass:"card-body"},[i("div",{staticClass:"caption"},[i("p",{staticClass:"mb-2 read-more",staticStyle:{overflow:"hidden"}},[i("span",{staticClass:"username font-weight-bold"},[i("bdi",[i("span",{staticClass:"text-dark"},[t._v(t._s(t.profile.username))])])]),t._v(" "),i("span",{staticClass:"status-content",domProps:{innerHTML:t._s(e.caption.html)}})])]),t._v(" "),i("div",{staticClass:"timestamp mt-2"},[i("p",{staticClass:"small text-uppercase mb-0"},[i("a",{staticClass:"text-muted",attrs:{href:t.remotePostUrl(e)}},[i("timeago",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover.bottom",modifiers:{hover:!0,bottom:!0}}],attrs:{datetime:e.timestamp,"auto-update":90,"converter-options":{includeSeconds:!0},title:t.timestampFormat(e.timestamp)}})],1)])])])])])})),0)])]),t._v(" "),i("b-modal",{ref:"visitorContextMenu",attrs:{id:"visitor-context-menu","hide-footer":"","hide-header":"",centered:"",size:"sm","body-class":"list-group-flush p-0"}},[t.relationship?i("div",{staticClass:"list-group"},[i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.copyProfileLink}},[t._v("\n\t\t\t\t\tCopy Link\n\t\t\t\t")]),t._v(" "),!t.user||t.owner||t.relationship.muting?t._e():i("div",{staticClass:"list-group-item cursor-pointer text-center rounded",on:{click:t.muteProfile}},[t._v("\n\t\t\t\t\tMute\n\t\t\t\t")]),t._v(" "),t.user&&!t.owner&&t.relationship.muting?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded",on:{click:t.unmuteProfile}},[t._v("\n\t\t\t\t\tUnmute\n\t\t\t\t")]):t._e(),t._v(" "),t.user&&!t.owner?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.reportProfile}},[t._v("\n\t\t\t\t\tReport User\n\t\t\t\t")]):t._e(),t._v(" "),!t.user||t.owner||t.relationship.blocking?t._e():i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.blockProfile}},[t._v("\n\t\t\t\t\tBlock\n\t\t\t\t")]),t._v(" "),t.user&&!t.owner&&t.relationship.blocking?i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-dark",on:{click:t.unblockProfile}},[t._v("\n\t\t\t\t\tUnblock\n\t\t\t\t")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item cursor-pointer text-center rounded text-muted",on:{click:function(e){return t.$refs.visitorContextMenu.hide()}}},[t._v("\n\t\t\t\t\tClose\n\t\t\t\t")])]):t._e()]),t._v(" "),i("b-modal",{ref:"ctxModal",attrs:{id:"ctx-modal","hide-header":"","hide-footer":"",centered:"",rounded:"",size:"sm","body-class":"list-group-flush p-0 rounded"}},[i("div",{staticClass:"list-group text-center"},[t.ctxMenuStatus&&t.profile.id!=t.profile.id?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-danger",on:{click:function(e){return t.ctxMenuReportPost()}}},[t._v("Report inappropriate")]):t._e(),t._v(" "),t.ctxMenuStatus&&t.profile.id!=t.profile.id&&t.ctxMenuRelationship&&t.ctxMenuRelationship.following?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-danger",on:{click:function(e){return t.ctxMenuUnfollow()}}},[t._v("Unfollow")]):t._e(),t._v(" "),t.ctxMenuStatus&&t.profile.id!=t.profile.id&&t.ctxMenuRelationship&&!t.ctxMenuRelationship.following?i("div",{staticClass:"list-group-item rounded cursor-pointer font-weight-bold text-primary",on:{click:function(e){return t.ctxMenuFollow()}}},[t._v("Follow")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxMenuGoToPost()}}},[t._v("Go to post")]),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxMenuCopyLink()}}},[t._v("Copy Link")]),t._v(" "),t.profile&&1==t.profile.is_admin?i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.ctxModMenuShow()}}},[t._v("Moderation Tools")]):t._e(),t._v(" "),t.ctxMenuStatus&&(t.profile.is_admin||t.profile.id==t.profile.id)?i("div",{staticClass:"list-group-item rounded cursor-pointer",on:{click:function(e){return t.deletePost(t.ctxMenuStatus)}}},[t._v("Delete")]):t._e(),t._v(" "),i("div",{staticClass:"list-group-item rounded cursor-pointer text-lighter",on:{click:function(e){return t.closeCtxMenu()}}},[t._v("Cancel")])])])],1)])}),[],!1,null,"0eef0252",null);e.default=s.exports},"9tPo":function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=function(t,e){var i=t[1]||"",n=t[3];if(!n)return i;if(e&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=n.sources.map((function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"}));return[i].concat(r).concat([o]).join("\n")}var s;return[i].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i})).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o=0&&f.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var n=function(){0;return i.nc}();n&&(t.attrs.nonce=n)}return w(e,t.attrs),v(t,e),e}function w(t,e){Object.keys(e).forEach((function(i){t.setAttribute(i,e[i])}))}function _(t,e){var i,n,o,r;if(e.transform&&t.css){if(!(r="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=r}if(e.singleton){var s=u++;i=c||(c=g(e)),n=C.bind(null,i,s,!1),o=C.bind(null,i,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",w(e,t.attrs),v(t,e),e}(e),n=M.bind(null,i,e),o=function(){m(i),i.href&&URL.revokeObjectURL(i.href)}):(i=g(e),n=y.bind(null,i),o=function(){m(i)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var i=h(t,e);return p(i,e),function(t){for(var n=[],o=0;o
-

CW / NSFW / Hidden Media

+

{{status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}

(click to show)

- +
- + @@ -241,7 +241,8 @@ type: status.pf_type, url: status.url, sensitive: status.sensitive, - cw: status.sensitive + cw: status.sensitive, + spoiler_text: status.spoiler_text } }); let ids = data.map(status => status.id);