parent
							
								
									cbbdc98744
								
							
						
					
					
						commit
						9bc07c1a1c
					
				
					 3 changed files with 11 additions and 1 deletions
				
			
		|  | @ -140,3 +140,6 @@ autoAdmin: true | ||||||
| #proxySmtp: http://127.0.0.1:3128   # use HTTP/1.1 CONNECT | #proxySmtp: http://127.0.0.1:3128   # use HTTP/1.1 CONNECT | ||||||
| #proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4 | #proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4 | ||||||
| #proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5 | #proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5 | ||||||
|  | 
 | ||||||
|  | # Media Proxy | ||||||
|  | #mediaProxy: http://127.0.0.1:3000 | ||||||
|  |  | ||||||
|  | @ -52,6 +52,8 @@ export type Source = { | ||||||
| 		host: string; | 		host: string; | ||||||
| 		port: number; | 		port: number; | ||||||
| 	}; | 	}; | ||||||
|  | 
 | ||||||
|  | 	mediaProxy?: string; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ import { toPuny } from '../../misc/convert-host'; | ||||||
| import { ensure } from '../../prelude/ensure'; | import { ensure } from '../../prelude/ensure'; | ||||||
| import { awaitAll } from '../../prelude/await-all'; | import { awaitAll } from '../../prelude/await-all'; | ||||||
| import { SchemaType } from '../../misc/schema'; | import { SchemaType } from '../../misc/schema'; | ||||||
|  | import config from '../../config'; | ||||||
| 
 | 
 | ||||||
| export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>; | export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>; | ||||||
| 
 | 
 | ||||||
|  | @ -22,7 +23,11 @@ export class DriveFileRepository extends Repository<DriveFile> { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public getPublicUrl(file: DriveFile, thumbnail = false): string | null { | 	public getPublicUrl(file: DriveFile, thumbnail = false): string | null { | ||||||
| 		return thumbnail ? (file.thumbnailUrl || file.webpublicUrl || null) : (file.webpublicUrl || file.url); | 		let url = thumbnail ? (file.thumbnailUrl || file.webpublicUrl || null) : (file.webpublicUrl || file.url); | ||||||
|  | 		if (file.src !== null && file.userHost !== null && config.mediaProxy !== null) { | ||||||
|  | 			url = `${config.mediaProxy}/${thumbnail ? 'thumbnail' : ''}?url=${file.src}`; | ||||||
|  | 		} | ||||||
|  | 		return url; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public async clacDriveUsageOf(user: User['id'] | User): Promise<number> { | 	public async clacDriveUsageOf(user: User['id'] | User): Promise<number> { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue