mirror of https://github.com/pixelfed/pixelfed
commit
73ecb2f48a
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Avatar;
|
||||
use App\Profile;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class ImportAvatar implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $url;
|
||||
protected $profile;
|
||||
|
||||
/**
|
||||
* Delete the job if its models no longer exist.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $deleteWhenMissingModels = true;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($url, Profile $profile)
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->profile = $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$url = $this->url;
|
||||
$profile = $this->profile;
|
||||
|
||||
$basePath = $this->buildPath();
|
||||
}
|
||||
|
||||
public function buildPath()
|
||||
{
|
||||
$baseDir = storage_path('app/public/avatars');
|
||||
if (!is_dir($baseDir)) {
|
||||
mkdir($baseDir);
|
||||
}
|
||||
|
||||
$prefix = $this->profile->id;
|
||||
$padded = str_pad($prefix, 12, 0, STR_PAD_LEFT);
|
||||
$parts = str_split($padded, 3);
|
||||
foreach ($parts as $k => $part) {
|
||||
if ($k == 0) {
|
||||
$prefix = storage_path('app/public/avatars/'.$parts[0]);
|
||||
if (!is_dir($prefix)) {
|
||||
mkdir($prefix);
|
||||
}
|
||||
}
|
||||
if ($k == 1) {
|
||||
$prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1]);
|
||||
if (!is_dir($prefix)) {
|
||||
mkdir($prefix);
|
||||
}
|
||||
}
|
||||
if ($k == 2) {
|
||||
$prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2]);
|
||||
if (!is_dir($prefix)) {
|
||||
mkdir($prefix);
|
||||
}
|
||||
}
|
||||
if ($k == 3) {
|
||||
$avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3];
|
||||
$prefix = storage_path('app/'.$avatarpath);
|
||||
if (!is_dir($prefix)) {
|
||||
mkdir($prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir = storage_path('app/'.$avatarpath);
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir);
|
||||
}
|
||||
$path = $avatarpath.'/avatar.svg';
|
||||
return storage_path('app/'.$path);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformer\Api;
|
||||
|
||||
use League\Fractal;
|
||||
use App\DirectMessage;
|
||||
|
||||
class DirectMessageTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
public function transform(DirectMessage $dm)
|
||||
{
|
||||
return [
|
||||
'id' => $dm->id,
|
||||
'to_id' => $dm->to_id,
|
||||
'from_id' => $dm->from_id,
|
||||
'from_profile_ids' => $dm->from_profile_ids,
|
||||
'group_message' => $dm->group_message,
|
||||
'status_id' => $dm->status_id,
|
||||
'read_at' => $dm->read_at,
|
||||
'created_at' => $dm->created_at
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Util\Site;
|
||||
|
||||
use Cache;
|
||||
|
||||
class Config {
|
||||
|
||||
public static function get() {
|
||||
return Cache::remember('api:site:configuration', now()->addMinutes(30), function() {
|
||||
return [
|
||||
'uploader' => [
|
||||
'max_photo_size' => config('pixelfed.max_photo_size'),
|
||||
'max_caption_length' => config('pixelfed.max_caption_length'),
|
||||
'album_limit' => config('pixelfed.max_album_length'),
|
||||
'image_quality' => config('pixelfed.image_quality'),
|
||||
|
||||
'optimize_image' => config('pixelfed.optimize_image'),
|
||||
'optimize_video' => config('pixelfed.optimize_video'),
|
||||
|
||||
'media_types' => config('pixelfed.media_types'),
|
||||
'enforce_account_limit' => config('pixelfed.enforce_account_limit')
|
||||
],
|
||||
|
||||
'activitypub' => [
|
||||
'enabled' => config('federation.activitypub.enabled'),
|
||||
'remote_follow' => config('federation.activitypub.remoteFollow')
|
||||
],
|
||||
|
||||
'ab' => [
|
||||
'lc' => config('exp.lc'),
|
||||
'rec' => config('exp.rec'),
|
||||
'loops' => config('exp.loops')
|
||||
],
|
||||
|
||||
'site' => [
|
||||
'domain' => config('pixelfed.domain.app'),
|
||||
'url' => config('app.url')
|
||||
]
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public static function json() {
|
||||
return json_encode(self::get(), JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"+lRy":function(e,n){},0:function(e,n,t){t("JO1w"),t("+lRy"),t("xWuY"),t("YfGV"),e.exports=t("RvBz")},"8oxB":function(e,n){var t,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var f,s=[],a=!1,l=-1;function d(){a&&f&&(a=!1,f.length?s=f.concat(s):l=-1,s.length&&w())}function w(){if(!a){var e=c(d);a=!0;for(var n=s.length;n;){for(f=s,s=[];++l<n;)f&&f[l].run();l=-1,n=s.length}f=null,a=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(n){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function h(e,n){this.fun=e,this.array=n}function p(){}o.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];s.push(new h(e,n)),1!==s.length||a||c(w)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},HijD:function(e,n,t){window._=t("LvDl"),window.Popper=t("8L3F").default,window.pixelfed=window.pixelfed||{},window.$=window.jQuery=t("EVdn"),t("SYky"),window.axios=t("vDqi"),window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",t("KGuw");var r=document.head.querySelector('meta[name="csrf-token"]');r?window.axios.defaults.headers.common["X-CSRF-TOKEN"]=r.content:console.error("CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token")},JO1w:function(e,n,t){t("HijD")},RvBz:function(e,n){},YfGV:function(e,n){},YuTi:function(e,n){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},xWuY:function(e,n){},yLpj:function(e,n){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t}},[[0,0,1]]]);
|
||||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"+lRy":function(e,n){},0:function(e,n,t){t("JO1w"),t("+lRy"),t("xWuY"),t("YfGV"),e.exports=t("RvBz")},"8oxB":function(e,n){var t,o,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var f,l=[],s=!1,a=-1;function w(){s&&f&&(s=!1,f.length?l=f.concat(l):a=-1,l.length&&d())}function d(){if(!s){var e=c(w);s=!0;for(var n=l.length;n;){for(f=l,l=[];++a<n;)f&&f[a].run();a=-1,n=l.length}f=null,s=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(n){try{return o.call(null,e)}catch(n){return o.call(this,e)}}}(e)}}function p(e,n){this.fun=e,this.array=n}function h(){}r.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];l.push(new p(e,n)),1!==l.length||s||c(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},JO1w:function(e,n,t){window._=t("LvDl"),window.Popper=t("8L3F").default,window.pixelfed=window.pixelfed||{},window.$=window.jQuery=t("EVdn"),t("SYky"),window.axios=t("vDqi"),window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",t("KGuw");var o=document.head.querySelector('meta[name="csrf-token"]');o?window.axios.defaults.headers.common["X-CSRF-TOKEN"]=o.content:console.error("CSRF token not found."),window.App=window.App||{},window.App.boot=function(){new Vue({el:"#content"})}},RvBz:function(e,n){},YfGV:function(e,n){},YuTi:function(e,n){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},xWuY:function(e,n){},yLpj:function(e,n){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t}},[[0,0,1]]]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,122 +1,105 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div>
|
||||
<div v-if="!loaded" style="height: 70vh;" class="d-flex justify-content-center align-items-center">
|
||||
<img src="/img/pixelfed-icon-grey.svg">
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="d-block d-md-none px-0 border-top-0 mx-n3">
|
||||
<input class="form-control rounded-0" placeholder="Search" v-model="searchTerm" v-on:keyup.enter="searchSubmit">
|
||||
</div>
|
||||
<section class="d-none d-md-flex mb-md-2 pt-5 discover-bar" style="width:auto; overflow: auto hidden;" v-if="categories.length > 0">
|
||||
<a v-if="config.ab.loops == true" class="text-decoration-none bg-transparent border border-success rounded d-inline-flex align-items-center justify-content-center mr-3 card-disc" href="/discover/loops">
|
||||
<p class="text-success lead font-weight-bold mb-0">Loops</p>
|
||||
</a>
|
||||
<a v-for="(category, index) in categories" :key="index+'_cat_'" class="bg-dark rounded d-inline-flex align-items-end justify-content-center mr-3 box-shadow card-disc" :href="category.url" :style="'background: linear-gradient(rgba(0, 0, 0, 0.3),rgba(0, 0, 0, 0.3)),url('+category.thumb+');'">
|
||||
<p class="text-white font-weight-bold" style="text-shadow: 3px 3px 16px #272634;">{{category.name}}</p>
|
||||
</a>
|
||||
|
||||
<section class="d-none d-md-flex mb-md-2 pt-2 discover-bar" style="width:auto; overflow: auto hidden;" v-if="categories.length > 0">
|
||||
<a v-if="config.ab.loops == true" class="text-decoration-none bg-transparent border border-success rounded d-inline-flex align-items-center justify-content-center mr-3 card-disc" href="/discover/loops">
|
||||
<p class="text-success lead font-weight-bold mb-0">Loops</p>
|
||||
</a>
|
||||
<!-- <a class="text-decoration-none rounded d-inline-flex align-items-center justify-content-center mr-3 box-shadow card-disc" href="/discover/personal" style="background: rgb(255, 95, 109);">
|
||||
<p class="text-white lead font-weight-bold mb-0">For You</p>
|
||||
</a> -->
|
||||
|
||||
<a v-for="(category, index) in categories" :key="index+'_cat_'" class="bg-dark rounded d-inline-flex align-items-end justify-content-center mr-3 box-shadow card-disc" :href="category.url" :style="'background: linear-gradient(rgba(0, 0, 0, 0.3),rgba(0, 0, 0, 0.3)),url('+category.thumb+');'">
|
||||
<p class="text-white font-weight-bold" style="text-shadow: 3px 3px 16px #272634;">{{category.name}}</p>
|
||||
</a>
|
||||
|
||||
</section>
|
||||
<section class="mb-5 section-explore">
|
||||
<div class="profile-timeline">
|
||||
<div class="loader text-center">
|
||||
<div class="lds-ring"><div></div><div></div><div></div><div></div></div>
|
||||
</div>
|
||||
<div class="row d-none">
|
||||
<div class="col-4 p-0 p-sm-2 p-md-3" v-for="post in posts">
|
||||
<a class="card info-overlay card-md-border-0" :href="post.url">
|
||||
<div class="square">
|
||||
<span v-if="post.type == 'photo:album'" class="float-right mr-3 post-icon"><i class="fas fa-images fa-2x"></i></span>
|
||||
<span v-if="post.type == 'video'" class="float-right mr-3 post-icon"><i class="fas fa-video fa-2x"></i></span>
|
||||
<span v-if="post.type == 'video:album'" class="float-right mr-3 post-icon"><i class="fas fa-film fa-2x"></i></span>
|
||||
<div class="square-content" v-bind:style="{ 'background-image': 'url(' + post.thumb + ')' }">
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mb-5">
|
||||
<p class="lead text-center">To view more posts, check the <a href="/" class="font-weight-bold">home</a> or <a href="/timeline/public" class="font-weight-bold">local</a> timelines.</p>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mb-5 section-explore">
|
||||
<div class="profile-timeline">
|
||||
<div class="row p-0">
|
||||
<div class="col-4 p-1 p-sm-2 p-md-3" v-for="post in posts">
|
||||
<a class="card info-overlay card-md-border-0" :href="post.url">
|
||||
<div class="square">
|
||||
<span v-if="post.type == 'photo:album'" class="float-right mr-3 post-icon"><i class="fas fa-images fa-2x"></i></span>
|
||||
<span v-if="post.type == 'video'" class="float-right mr-3 post-icon"><i class="fas fa-video fa-2x"></i></span>
|
||||
<span v-if="post.type == 'video:album'" class="float-right mr-3 post-icon"><i class="fas fa-film fa-2x"></i></span>
|
||||
<div class="square-content" v-bind:style="{ 'background-image': 'url(' + post.thumb + ')' }">
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mb-5">
|
||||
<p class="lead text-center">To view more posts, check the <a href="/" class="font-weight-bold">home</a> or <a href="/timeline/public" class="font-weight-bold">local</a> timelines.</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style type="text/css" scoped>
|
||||
.discover-bar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.card-disc {
|
||||
flex: 0 0 160px;
|
||||
width:160px;
|
||||
height:100px;
|
||||
background-size: cover !important;
|
||||
}
|
||||
.post-icon {
|
||||
color: #fff;
|
||||
position:relative;
|
||||
margin-top: 10px;
|
||||
z-index: 9;
|
||||
opacity: 0.6;
|
||||
text-shadow: 3px 3px 16px #272634;
|
||||
}
|
||||
.discover-bar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.card-disc {
|
||||
flex: 0 0 160px;
|
||||
width:160px;
|
||||
height:100px;
|
||||
background-size: cover !important;
|
||||
}
|
||||
.post-icon {
|
||||
color: #fff;
|
||||
position:relative;
|
||||
margin-top: 10px;
|
||||
z-index: 9;
|
||||
opacity: 0.6;
|
||||
text-shadow: 3px 3px 16px #272634;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config: {},
|
||||
posts: {},
|
||||
trending: {},
|
||||
categories: {},
|
||||
allCategories: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
this.fetchCategories();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
followUser(id, event) {
|
||||
axios.post('/i/follow', {
|
||||
item: id
|
||||
}).then(res => {
|
||||
let el = $(event.target);
|
||||
el.addClass('btn-outline-secondary').removeClass('btn-primary');
|
||||
el.text('Unfollow');
|
||||
}).catch(err => {
|
||||
if(err.response.data.message) {
|
||||
swal('Error', err.response.data.message, 'error');
|
||||
}
|
||||
});
|
||||
},
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loaded: false,
|
||||
config: window.App.config,
|
||||
posts: {},
|
||||
trending: {},
|
||||
categories: {},
|
||||
allCategories: {},
|
||||
searchTerm: '',
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
this.fetchCategories();
|
||||
},
|
||||
|
||||
fetchData() {
|
||||
axios.get('/api/v2/config')
|
||||
.then((res) => {
|
||||
let data = res.data;
|
||||
this.config = data;
|
||||
});
|
||||
axios.get('/api/v2/discover/posts')
|
||||
.then((res) => {
|
||||
let data = res.data;
|
||||
this.posts = data.posts;
|
||||
methods: {
|
||||
fetchData() {
|
||||
axios.get('/api/v2/discover/posts')
|
||||
.then((res) => {
|
||||
this.posts = res.data.posts;
|
||||
this.loaded = true;
|
||||
});
|
||||
},
|
||||
|
||||
if(this.posts.length > 1) {
|
||||
$('.section-explore .loader').hide();
|
||||
$('.section-explore .row.d-none').removeClass('d-none');
|
||||
}
|
||||
});
|
||||
},
|
||||
fetchCategories() {
|
||||
axios.get('/api/v2/discover/categories')
|
||||
.then(res => {
|
||||
this.allCategories = res.data;
|
||||
this.categories = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
fetchCategories() {
|
||||
axios.get('/api/v2/discover/categories')
|
||||
.then(res => {
|
||||
this.allCategories = res.data;
|
||||
this.categories = res.data;
|
||||
});
|
||||
},
|
||||
searchSubmit() {
|
||||
if(this.searchTerm.length > 1) {
|
||||
window.location.href = '/i/results?q=' + this.searchTerm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,17 +1,13 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-5 pt-3">
|
||||
<section>
|
||||
<discover-component></discover-component>
|
||||
</section>
|
||||
<div class="container">
|
||||
<discover-component></discover-component>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript" src="{{ mix('js/discover.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/compose.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){new Vue({el: '#content'});});
|
||||
</script>
|
||||
<script type="text/javascript">App.boot();</script>
|
||||
@endpush
|
Loading…
Reference in New Issue