kopia lustrzana https://github.com/pixelfed/pixelfed
				
				
				
			Update AccountImports, add webp support
							rodzic
							
								
									f4e8ae0c29
								
							
						
					
					
						commit
						01b445f6ea
					
				|  | @ -109,11 +109,11 @@ class TransformImports extends Command | |||
|             $status->caption = $caption; | ||||
|             $status->type = $ip->post_type; | ||||
| 
 | ||||
|             $status->scope = 'unlisted'; | ||||
|             $status->visibility = 'unlisted'; | ||||
|             $status->scope = 'public'; | ||||
|             $status->visibility = 'public'; | ||||
|             $status->id = $idk['id']; | ||||
|             $status->created_at = now()->parse($ip->creation_date); | ||||
|             $status->save(); | ||||
|             $status->saveQuietly(); | ||||
| 
 | ||||
|             foreach ($ip->media as $ipm) { | ||||
|                 $fileName = last(explode('/', $ipm['uri'])); | ||||
|  |  | |||
|  | @ -29,6 +29,8 @@ class ImportPostController extends Controller | |||
| 
 | ||||
|             'allow_video_posts' => config('import.instagram.allow_video_posts'), | ||||
| 
 | ||||
|             'allow_image_webp' => config('import.instagram.allow_image_webp') && str_contains(config_cache('pixelfed.media_types'), 'image/webp'), | ||||
| 
 | ||||
|             'permissions' => [ | ||||
|                 'admins_only' => config('import.instagram.permissions.admins_only'), | ||||
|                 'admin_follows_only' => config('import.instagram.permissions.admin_follows_only'), | ||||
|  |  | |||
|  | @ -24,6 +24,9 @@ return [ | |||
|         // Allow video posts to be imported
 | ||||
|         'allow_video_posts' => env('PF_IMPORT_IG_ALLOW_VIDEO_POSTS', true), | ||||
| 
 | ||||
|         // Allow webp posts to be imported
 | ||||
|         'allow_image_webp' => env('PF_IMPORT_IG_ALLOW_IMAGE_WEBP', true), | ||||
| 
 | ||||
|         'permissions' => [ | ||||
|             // Limit to admin accounts only
 | ||||
|             'admins_only' => env('PF_IMPORT_IG_PERM_ADMIN_ONLY', false), | ||||
|  |  | |||
|  | @ -107,7 +107,7 @@ | |||
|                         <p v-else class="lead mb-0"><span class="font-weight-bold">{{ selectedPostsCounter }}</span> posts selected for import</p> | ||||
| 
 | ||||
|                         <button v-if="selectedMedia.length" class="btn btn-outline-danger font-weight-bold rounded-pill btn-sm my-1" @click="handleClearAll()">Clear all selected</button> | ||||
|                         <button v-else class="btn btn-outline-primary font-weight-bold rounded-pill" @click="handleSelectAll()">Select first 100 posts</button> | ||||
|                         <button v-else class="btn btn-outline-primary font-weight-bold rounded-pill" @click="handleSelectAll()">Select first {{ toggleLimit }} posts</button> | ||||
|                     </div> | ||||
|                 </section> | ||||
|                 <section class="row mb-n5 media-selector" style="max-height: 600px;overflow-y: auto;"> | ||||
|  | @ -233,7 +233,7 @@ | |||
|             return { | ||||
|                 page: 1, | ||||
|                 step: 1, | ||||
|                 toggleLimit: 100, | ||||
|                 toggleLimit: 300, | ||||
|                 config: {}, | ||||
|                 showDisabledWarning: false, | ||||
|                 showNotAllowedWarning: false, | ||||
|  | @ -375,11 +375,14 @@ | |||
|                 } | ||||
|                 let res = json.filter(j => { | ||||
|                     let ids = j.media.map(m => m.uri).filter(m => { | ||||
|                         if(this.config.allow_video_posts == true) { | ||||
|                             return m.endsWith('.png') || m.endsWith('.jpg') || m.endsWith('.mp4'); | ||||
|                         } else { | ||||
|                             return m.endsWith('.png') || m.endsWith('.jpg'); | ||||
|                         const supportedFormats = ['.png', '.jpg']; | ||||
|                         if (this.config.allow_video_posts) { | ||||
|                           supportedFormats.push('.mp4'); | ||||
|                         } | ||||
|                         if (this.config.allow_image_webp) { | ||||
|                           supportedFormats.push('.webp'); | ||||
|                         } | ||||
|                         return supportedFormats.some(format => m.endsWith(format)); | ||||
|                     }); | ||||
|                     return ids.length; | ||||
|                 }).filter(j => { | ||||
|  | @ -621,7 +624,7 @@ | |||
|             }, | ||||
| 
 | ||||
|             handleSelectAll() { | ||||
|                 let medias = this.postMeta.slice(0, 100); | ||||
|                 let medias = this.postMeta.slice(0, this.toggleLimit); | ||||
|                 for (var i = medias.length - 1; i >= 0; i--) { | ||||
|                     let m = medias[i]; | ||||
|                     this.toggleSelectedPost(m); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Daniel Supernault
						Daniel Supernault