Merge pull request #1889 from pixelfed/staging

Add Force MetroUI labs experiment
This commit is contained in:
daniel 2019-12-14 13:14:46 -07:00 committed by GitHub
commit c5a82c56fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 15 deletions

View file

@ -7,6 +7,7 @@
- Added AccountService ([885a1258](https://github.com/pixelfed/pixelfed/commit/885a1258)) - Added AccountService ([885a1258](https://github.com/pixelfed/pixelfed/commit/885a1258))
- Added post embeds ([1fecf717](https://github.com/pixelfed/pixelfed/commit/1fecf717)) - Added post embeds ([1fecf717](https://github.com/pixelfed/pixelfed/commit/1fecf717))
- Added profile embeds ([fb7a3cf0](https://github.com/pixelfed/pixelfed/commit/fb7a3cf0)) - Added profile embeds ([fb7a3cf0](https://github.com/pixelfed/pixelfed/commit/fb7a3cf0))
- Added Force MetroUI labs experiment ([#1889](https://github.com/pixelfed/pixelfed/pull/1889))
### Fixed ### Fixed
- Fixed like and share/reblog count on profiles ([86cb7d09](https://github.com/pixelfed/pixelfed/commit/86cb7d09)) - Fixed like and share/reblog count on profiles ([86cb7d09](https://github.com/pixelfed/pixelfed/commit/86cb7d09))

View file

@ -214,6 +214,10 @@ class FederationController extends Controller
$bodyDecoded = json_decode($body, true, 8); $bodyDecoded = json_decode($body, true, 8);
$signature = $request->header('signature'); $signature = $request->header('signature');
$date = $request->header('date'); $date = $request->header('date');
$digest = $request->header('digest');
if(!$digest) {
abort(400, 'Missing digest header');
}
if(!$signature) { if(!$signature) {
abort(400, 'Missing signature header'); abort(400, 'Missing signature header');
} }

View file

@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div v-if="loaded && warning == false" class="postComponent"> <div v-if="loaded && warning == false" class="postComponent">
<div v-if="profileLayout == 'metro'" class="container px-0"> <div v-if="layout == 'metro'" class="container px-0">
<div class="card card-md-rounded-0 status-container orientation-unknown shadow-none border"> <div class="card card-md-rounded-0 status-container orientation-unknown shadow-none border">
<div class="row px-0 mx-0"> <div class="row px-0 mx-0">
<div class="d-flex d-md-none align-items-center justify-content-between card-header bg-white w-100"> <div class="d-flex d-md-none align-items-center justify-content-between card-header bg-white w-100">
@ -245,7 +245,7 @@
</div> </div>
</div> </div>
<div v-if="profileLayout == 'moment'" class="momentui"> <div v-if="layout == 'moment'" class="momentui">
<div class="bg-dark mt-md-n4"> <div class="bg-dark mt-md-n4">
<div class="container" v-on:dblclick="likeStatus"> <div class="container" v-on:dblclick="likeStatus">
<div class="postPresenterContainer d-none d-flex justify-content-center align-items-center bg-dark"> <div class="postPresenterContainer d-none d-flex justify-content-center align-items-center bg-dark">
@ -619,16 +619,18 @@ export default {
showCaption: true, showCaption: true,
ctxEmbedPayload: false, ctxEmbedPayload: false,
copiedEmbed: false, copiedEmbed: false,
layout: this.profileLayout
} }
}, },
beforeMount() { beforeMount() {
let u = new URLSearchParams(window.location.search); let u = new URLSearchParams(window.location.search);
if(u.has('ui') && u.get('ui') == 'moment' && this.profileLayout != 'moment') { let forceMetro = localStorage.getItem('pf_metro_ui.exp.forceMetro') == 'true';
this.profileLayout = 'moment'; if(forceMetro == true || u.has('ui') && u.get('ui') == 'metro' && this.layout != 'metro') {
this.layout = 'metro';
} }
if(u.has('ui') && u.get('ui') == 'metro' && this.profileLayout != 'metro') { if(u.has('ui') && u.get('ui') == 'moment' && this.layout != 'moment') {
this.profileLayout = 'metro'; this.layout = 'moment';
} }
}, },
@ -914,7 +916,7 @@ export default {
.then(function(res) { .then(function(res) {
let entity = res.data.entity; let entity = res.data.entity;
if(entity.in_reply_to_id == self.status.id) { if(entity.in_reply_to_id == self.status.id) {
if(self.profileLayout == 'metro') { if(self.layout == 'metro') {
self.results.push(entity); self.results.push(entity);
} else { } else {
self.results.unshift(entity); self.results.unshift(entity);
@ -973,7 +975,7 @@ export default {
axios.get(url) axios.get(url)
.then(response => { .then(response => {
let self = this; let self = this;
this.results = this.profileLayout == 'metro' ? this.results = this.layout == 'metro' ?
_.reverse(response.data.data) : _.reverse(response.data.data) :
response.data.data; response.data.data;
this.pagination = response.data.meta.pagination; this.pagination = response.data.meta.pagination;

View file

@ -569,20 +569,17 @@
} }
}, },
beforeMount() { beforeMount() {
if(window.outerWidth < 576) {
$('nav.navbar').hide();
this.isMobile = true;
}
this.fetchRelationships(); this.fetchRelationships();
this.fetchProfile(); this.fetchProfile();
let u = new URLSearchParams(window.location.search); let u = new URLSearchParams(window.location.search);
let forceMetro = localStorage.getItem('pf_metro_ui.exp.forceMetro') == 'true';
if(forceMetro == true || u.has('ui') && u.get('ui') == 'metro' && this.layout != 'metro') {
this.layout = 'metro';
}
if(u.has('ui') && u.get('ui') == 'moment' && this.layout != 'moment') { if(u.has('ui') && u.get('ui') == 'moment' && this.layout != 'moment') {
Vue.use(VueMasonry); Vue.use(VueMasonry);
this.layout = 'moment'; this.layout = 'moment';
} }
if(u.has('ui') && u.get('ui') == 'metro' && this.layout != 'metro') {
this.layout = 'metro';
}
if(this.layout == 'metro' && u.has('t')) { if(this.layout == 'metro' && u.has('t')) {
if(this.modes.indexOf(u.get('t')) != -1) { if(this.modes.indexOf(u.get('t')) != -1) {
if(u.get('t') == 'bookmarks') { if(u.get('t') == 'bookmarks') {
@ -607,6 +604,10 @@
this.user = res.data; this.user = res.data;
}); });
} }
if(window.outerWidth < 576) {
$('nav.navbar').hide();
this.isMobile = true;
}
}, },
updated() { updated() {

View file

@ -182,6 +182,11 @@
<label class="form-check-label font-weight-bold">Show Tips</label> <label class="form-check-label font-weight-bold">Show Tips</label>
<p class="text-muted small help-text">Show Tips on Timelines (Desktop Only)</p> <p class="text-muted small help-text">Show Tips on Timelines (Desktop Only)</p>
</div> </div>
<div class="form-check pb-3">
<input class="form-check-input" type="checkbox" id="force_metro">
<label class="form-check-label font-weight-bold">Force Metro Layout</label>
<p class="text-muted small help-text">Force MetroUI layout for profiles and posts.</p>
</div>
<div class="py-3"> <div class="py-3">
<p class="font-weight-bold text-muted text-center">Discovery</p> <p class="font-weight-bold text-muted text-center">Discovery</p>
<hr> <hr>
@ -210,6 +215,7 @@ $(document).ready(function() {
let showSuggestions = localStorage.getItem('pf_metro_ui.exp.rec') == 'false' ? false : true; let showSuggestions = localStorage.getItem('pf_metro_ui.exp.rec') == 'false' ? false : true;
let showReadMore = localStorage.getItem('pf_metro_ui.exp.rm') == 'false' ? false : true; let showReadMore = localStorage.getItem('pf_metro_ui.exp.rm') == 'false' ? false : true;
let distractionFree = localStorage.getItem('pf_metro_ui.exp.df') == 'true' ? true : false; let distractionFree = localStorage.getItem('pf_metro_ui.exp.df') == 'true' ? true : false;
let forceMetro = localStorage.getItem('pf_metro_ui.exp.forceMetro') == 'true' ? true : false;
if(showSuggestions == true) { if(showSuggestions == true) {
$('#show_suggestions').attr('checked', true); $('#show_suggestions').attr('checked', true);
@ -227,6 +233,10 @@ $(document).ready(function() {
$('#show_tips').attr('checked', true); $('#show_tips').attr('checked', true);
} }
if(forceMetro == true) {
$('#force_metro').attr('checked', true);
}
$('#show_suggestions').on('change', function(e) { $('#show_suggestions').on('change', function(e) {
if(e.target.checked) { if(e.target.checked) {
localStorage.removeItem('pf_metro_ui.exp.rec'); localStorage.removeItem('pf_metro_ui.exp.rec');
@ -258,6 +268,14 @@ $(document).ready(function() {
localStorage.removeItem('metro-tips'); localStorage.removeItem('metro-tips');
} }
}); });
$('#force_metro').on('change', function(e) {
if(e.target.checked) {
localStorage.setItem('pf_metro_ui.exp.forceMetro', true);
} else {
localStorage.removeItem('pf_metro_ui.exp.forceMetro');
}
})
}); });
</script> </script>
@endpush @endpush