Merge pull request #4730 from pixelfed/staging

Staging
This commit is contained in:
daniel 2023-11-02 04:37:39 -06:00 committed by GitHub
commit e45ede5a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 19 deletions

View File

@ -40,6 +40,9 @@
- Update ApiV1Dot1Controller, allow iar rate limits to be configurable ([28a80803](https://github.com/pixelfed/pixelfed/commit/28a80803))
- Update ApiV1Dot1Controller, add domain to iar redirect ([1f82d47c](https://github.com/pixelfed/pixelfed/commit/1f82d47c))
- Update ApiV1Dot1Controller, add configurable app confirm rate limit ttl ([4c6a0719](https://github.com/pixelfed/pixelfed/commit/4c6a0719))
- Update LikePipeline, dispatch to feed queue. Fixes ([#4723](https://github.com/pixelfed/pixelfed/issues/4723)) ([da510089](https://github.com/pixelfed/pixelfed/commit/da510089))
- Update AccountImport ([5a2d7e3e](https://github.com/pixelfed/pixelfed/commit/5a2d7e3e))
- Update ImportPostController, fix IG bug with missing spaces between hashtags ([9c24157a](https://github.com/pixelfed/pixelfed/commit/9c24157a))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)

View File

@ -83,6 +83,17 @@ class ImportPostController extends Controller
);
}
public function formatHashtags($val = false)
{
if(!$val || !strlen($val)) {
return null;
}
$groupedHashtagRegex = '/#\w+(?=#)/';
return preg_replace($groupedHashtagRegex, '$0 ', $val);
}
public function store(Request $request)
{
abort_unless(config('import.instagram.enabled'), 404);
@ -128,11 +139,11 @@ class ImportPostController extends Controller
$ip->media = $c->map(function($m) {
return [
'uri' => $m['uri'],
'title' => $m['title'],
'title' => $this->formatHashtags($m['title']),
'creation_timestamp' => $m['creation_timestamp']
];
})->toArray();
$ip->caption = $c->count() > 1 ? $file['title'] : $ip->media[0]['title'];
$ip->caption = $c->count() > 1 ? $this->formatHashtags($file['title']) : $this->formatHashtags($ip->media[0]['title']);
$ip->filename = last(explode('/', $ip->media[0]['uri']));
$ip->metadata = $c->map(function($m) {
return [

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

View File

@ -1 +1 @@
(()=>{"use strict";var e,r,n,o={},t={};function d(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,d),n.loaded=!0,n.exports}d.m=o,e=[],d.O=(r,n,o,t)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,o,t]=e[l],i=!0,c=0;c<n.length;c++)(!1&t||a>=t)&&Object.keys(d.O).every((e=>d.O[e](n[c])))?n.splice(c--,1):(i=!1,t<a&&(a=t));if(i){e.splice(l--,1);var s=o();void 0!==s&&(r=s)}}return r}t=t||0;for(var l=e.length;l>0&&e[l-1][2]>t;l--)e[l]=e[l-1];e[l]=[n,o,t]},d.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return d.d(r,{a:r}),r},d.d=(e,r)=>{for(var n in r)d.o(r,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((r,n)=>(d.f[n](e,r),r)),[])),d.u=e=>"js/"+{1084:"profile~followers.bundle",2470:"home.chunk",2530:"discover~myhashtags.chunk",2586:"compose.chunk",2732:"dms~message.chunk",3351:"discover~settings.chunk",3365:"dms.chunk",3623:"discover~findfriends.chunk",4028:"error404.bundle",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7019:"discover~hashtag.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk"}[e]+"."+{1084:"731f680cfb96563d",2470:"351f55e9d09b6482",2530:"6eab2414b2b16e19",2586:"965eab35620423e5",2732:"15157ff4a6c17cc7",3351:"732c1f76a00d9204",3365:"53a951c5de2d95ac",3623:"02be60ab26503531",4028:"3bbc118159460db6",4958:"9606885dad3c8a99",4965:"ce9cc6446020e9b3",5865:"74f8b1d1954f5d01",6053:"3b92cf46da469de1",6869:"0e5bd852054d6355",7019:"9cfffc517f35044e",8250:"47cbf9f04d955267",8517:"b17a0b11877389d7",8600:"742a06ba0a547120",8625:"3d95796c9f1678dd",8900:"0f2dcc473fdce17e"}[e]+".js",d.miniCssF=e=>({138:"css/spa",703:"css/admin",1242:"css/appdark",6170:"css/app",8737:"css/portfolio",9994:"css/landing"}[e]+".css"),d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},n="pixelfed:",d.l=(e,o,t,a)=>{if(r[e])r[e].push(o);else{var i,c;if(void 0!==t)for(var s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var u=s[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+t){i=u;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,d.nc&&i.setAttribute("nonce",d.nc),i.setAttribute("data-webpack",n+t),i.src=e),r[e]=[o];var f=(n,o)=>{i.onerror=i.onload=null,clearTimeout(b);var t=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),t&&t.forEach((e=>e(o))),n)return n(o)},b=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),c&&document.head.appendChild(i)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),d.p="/",(()=>{var e={8929:0,1242:0,6170:0,8737:0,703:0,9994:0,138:0};d.f.j=(r,n)=>{var o=d.o(e,r)?e[r]:void 0;if(0!==o)if(o)n.push(o[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var t=new Promise(((n,t)=>o=e[r]=[n,t]));n.push(o[2]=t);var a=d.p+d.u(r),i=new Error;d.l(a,(n=>{if(d.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var t=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;i.message="Loading chunk "+r+" failed.\n("+t+": "+a+")",i.name="ChunkLoadError",i.type=t,i.request=a,o[1](i)}}),"chunk-"+r,r)}},d.O.j=r=>0===e[r];var r=(r,n)=>{var o,t,[a,i,c]=n,s=0;if(a.some((r=>0!==e[r]))){for(o in i)d.o(i,o)&&(d.m[o]=i[o]);if(c)var l=c(d)}for(r&&r(n);s<a.length;s++)t=a[s],d.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return d.O(l)},n=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),d.nc=void 0})();
(()=>{"use strict";var e,r,n,o={},t={};function d(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,d),n.loaded=!0,n.exports}d.m=o,e=[],d.O=(r,n,o,t)=>{if(!n){var c=1/0;for(l=0;l<e.length;l++){for(var[n,o,t]=e[l],a=!0,i=0;i<n.length;i++)(!1&t||c>=t)&&Object.keys(d.O).every((e=>d.O[e](n[i])))?n.splice(i--,1):(a=!1,t<c&&(c=t));if(a){e.splice(l--,1);var s=o();void 0!==s&&(r=s)}}return r}t=t||0;for(var l=e.length;l>0&&e[l-1][2]>t;l--)e[l]=e[l-1];e[l]=[n,o,t]},d.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return d.d(r,{a:r}),r},d.d=(e,r)=>{for(var n in r)d.o(r,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((r,n)=>(d.f[n](e,r),r)),[])),d.u=e=>"js/"+{1084:"profile~followers.bundle",2470:"home.chunk",2530:"discover~myhashtags.chunk",2586:"compose.chunk",2732:"dms~message.chunk",3351:"discover~settings.chunk",3365:"dms.chunk",3623:"discover~findfriends.chunk",4028:"error404.bundle",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7019:"discover~hashtag.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk"}[e]+"."+{1084:"731f680cfb96563d",2470:"351f55e9d09b6482",2530:"6eab2414b2b16e19",2586:"10e7f993dcc726f9",2732:"15157ff4a6c17cc7",3351:"732c1f76a00d9204",3365:"53a951c5de2d95ac",3623:"02be60ab26503531",4028:"3bbc118159460db6",4958:"9606885dad3c8a99",4965:"ce9cc6446020e9b3",5865:"23fc9e82d4fadc83",6053:"3b92cf46da469de1",6869:"0e5bd852054d6355",7019:"9cfffc517f35044e",8250:"47cbf9f04d955267",8517:"b17a0b11877389d7",8600:"742a06ba0a547120",8625:"3d95796c9f1678dd",8900:"0f2dcc473fdce17e"}[e]+".js",d.miniCssF=e=>({138:"css/spa",703:"css/admin",1242:"css/appdark",6170:"css/app",8737:"css/portfolio",9994:"css/landing"}[e]+".css"),d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},n="pixelfed:",d.l=(e,o,t,c)=>{if(r[e])r[e].push(o);else{var a,i;if(void 0!==t)for(var s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var f=s[l];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+t){a=f;break}}a||(i=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,d.nc&&a.setAttribute("nonce",d.nc),a.setAttribute("data-webpack",n+t),a.src=e),r[e]=[o];var u=(n,o)=>{a.onerror=a.onload=null,clearTimeout(b);var t=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),t&&t.forEach((e=>e(o))),n)return n(o)},b=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),i&&document.head.appendChild(a)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),d.p="/",(()=>{var e={8929:0,1242:0,6170:0,8737:0,703:0,9994:0,138:0};d.f.j=(r,n)=>{var o=d.o(e,r)?e[r]:void 0;if(0!==o)if(o)n.push(o[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var t=new Promise(((n,t)=>o=e[r]=[n,t]));n.push(o[2]=t);var c=d.p+d.u(r),a=new Error;d.l(c,(n=>{if(d.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var t=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;a.message="Loading chunk "+r+" failed.\n("+t+": "+c+")",a.name="ChunkLoadError",a.type=t,a.request=c,o[1](a)}}),"chunk-"+r,r)}},d.O.j=r=>0===e[r];var r=(r,n)=>{var o,t,[c,a,i]=n,s=0;if(c.some((r=>0!==e[r]))){for(o in a)d.o(a,o)&&(d.m[o]=a[o]);if(i)var l=i(d)}for(r&&r(n);s<c.length;s++)t=c[s],d.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return d.O(l)},n=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),d.nc=void 0})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,13 +6,13 @@
"/js/profile.js": "/js/profile.js?id=ff5ebfe2c05af42a90710184b4a77539",
"/js/status.js": "/js/status.js?id=28214c81b6ef1b443735edb12a3e2af3",
"/js/timeline.js": "/js/timeline.js?id=6af047689b6d4871c816eb9bbd258d6c",
"/js/compose.js": "/js/compose.js?id=b57ac94e8e497e2a45f0353cc49aee5b",
"/js/compose.js": "/js/compose.js?id=17cac013a117745417d908362686b48f",
"/js/compose-classic.js": "/js/compose-classic.js?id=6a1e3218c8d3753687e01aeaad9362c9",
"/js/search.js": "/js/search.js?id=4c0e6f5e1b7f43de760c28143605a161",
"/js/developers.js": "/js/developers.js?id=5c04c9c265a39ff23dd395fc56a0eada",
"/js/hashtag.js": "/js/hashtag.js?id=ede3503b82bd2c3dc031cb1a4f70320d",
"/js/collectioncompose.js": "/js/collectioncompose.js?id=4ce940e158d15205ad480821d3d8cd0c",
"/js/collections.js": "/js/collections.js?id=b82669dac1dc1a86c3c33e4ba4bc575a",
"/js/collections.js": "/js/collections.js?id=c081a4a410b0e1221ab5d549da906874",
"/js/profile-directory.js": "/js/profile-directory.js?id=9b8a56ca460ece9bcd0dcfc4e5d7fa2b",
"/js/story-compose.js": "/js/story-compose.js?id=08a03cf5642c4dcfec5ad2ef78f83c00",
"/js/direct.js": "/js/direct.js?id=74c2962c91cfa3817126b093c3e8112d",
@ -20,14 +20,14 @@
"/js/spa.js": "/js/spa.js?id=3d4942f9a9920995110f87454f9a5979",
"/js/stories.js": "/js/stories.js?id=709b3201264dd2e3776f03ec3393d6b4",
"/js/portfolio.js": "/js/portfolio.js?id=f44a3a87fee04698b55d91a4231fcb8f",
"/js/account-import.js": "/js/account-import.js?id=fe788ad033b51af54f93f6c7b4eb912b",
"/js/account-import.js": "/js/account-import.js?id=71ac9c7b86270addf9e05c72ed3d76f5",
"/js/admin_invite.js": "/js/admin_invite.js?id=285b7aab611b66b12e16fb95c5cd6a24",
"/js/landing.js": "/js/landing.js?id=0b4df98090afe60d42a25fae96b70a69",
"/js/remote_auth.js": "/js/remote_auth.js?id=8a261c63271e4f126bc259ca94fe691c",
"/js/manifest.js": "/js/manifest.js?id=57032dfd7b47112c377e9e24cce856f4",
"/js/manifest.js": "/js/manifest.js?id=07bf3cac0b7ce275ad1465fff457eebf",
"/js/home.chunk.351f55e9d09b6482.js": "/js/home.chunk.351f55e9d09b6482.js?id=78bec7e00db7fa42970b7fee6ae42fc8",
"/js/compose.chunk.965eab35620423e5.js": "/js/compose.chunk.965eab35620423e5.js?id=a1962c16057b41d2547c5974111766bf",
"/js/post.chunk.74f8b1d1954f5d01.js": "/js/post.chunk.74f8b1d1954f5d01.js?id=a7cd3ee72924d3d8b81044e63bf48755",
"/js/compose.chunk.10e7f993dcc726f9.js": "/js/compose.chunk.10e7f993dcc726f9.js?id=1ff97cb97bbe1ef6405aaf1367111f9d",
"/js/post.chunk.23fc9e82d4fadc83.js": "/js/post.chunk.23fc9e82d4fadc83.js?id=35af81651750a662b0bde9c2e9cd202f",
"/js/profile.chunk.0e5bd852054d6355.js": "/js/profile.chunk.0e5bd852054d6355.js?id=c79db9a7ed9e593c2565f6fe2647ddaa",
"/js/discover~memories.chunk.ce9cc6446020e9b3.js": "/js/discover~memories.chunk.ce9cc6446020e9b3.js?id=05823cac888d03c4a02db391f0497207",
"/js/discover~myhashtags.chunk.6eab2414b2b16e19.js": "/js/discover~myhashtags.chunk.6eab2414b2b16e19.js?id=3296235c4dfc2b53ec12fa3efd6b2853",

View File

@ -348,8 +348,18 @@
}, 500);
},
filterPostMeta(media) {
let json = JSON.parse(media);
async fixFacebookEncoding(string) {
// Facebook and Instagram are encoding UTF8 characters in a weird way in their json
// here is a good explanation what's going wrong https://sorashi.github.io/fix-facebook-json-archive-encoding
// See https://github.com/pixelfed/pixelfed/pull/4726 for more info
const replaced = string.replace(/\\u00([a-f0-9]{2})/g, (x) => String.fromCharCode(parseInt(x.slice(2), 16)));
const buffer = Array.from(replaced, (c) => c.charCodeAt(0));
return new TextDecoder().decode(new Uint8Array(buffer));
},
async filterPostMeta(media) {
let fbfix = await this.fixFacebookEncoding(media);
let json = JSON.parse(fbfix);
let res = json.filter(j => {
let ids = j.media.map(m => m.uri).filter(m => {
if(this.config.allow_video_posts == true) {
@ -396,12 +406,14 @@
this.filterPostMeta(media);
let imgs = await Promise.all(entries.filter(entry => {
return entry.filename.startsWith('media/posts/') && (entry.filename.endsWith('.png') || entry.filename.endsWith('.jpg') || entry.filename.endsWith('.mp4'));
return (entry.filename.startsWith('media/posts/') || entry.filename.startsWith('media/other/')) && (entry.filename.endsWith('.png') || entry.filename.endsWith('.jpg') || entry.filename.endsWith('.mp4'));
})
.map(async entry => {
if(
entry.filename.startsWith('media/posts/') &&
(
entry.filename.startsWith('media/posts/') ||
entry.filename.startsWith('media/other/')
) && (
entry.filename.endsWith('.png') ||
entry.filename.endsWith('.jpg') ||
entry.filename.endsWith('.mp4')