mirror of https://github.com/Chocobozzz/PeerTube
				
				
				
			Handle actors search beginning with '@'
Something like @toto@example.compull/1082/head
							parent
							
								
									743164fed1
								
							
						
					
					
						commit
						2ff83ae292
					
				| 
						 | 
				
			
			@ -56,6 +56,9 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
 | 
			
		|||
  const isURISearch = search.startsWith('http://') || search.startsWith('https://')
 | 
			
		||||
 | 
			
		||||
  const parts = search.split('@')
 | 
			
		||||
 | 
			
		||||
  // Handle strings like @toto@example.com
 | 
			
		||||
  if (parts.length === 3 && parts[0].length === 0) parts.shift()
 | 
			
		||||
  const isWebfingerSearch = parts.length === 2 && parts.every(p => p.indexOf(' ') === -1)
 | 
			
		||||
 | 
			
		||||
  if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,10 @@ const webfinger = new WebFinger({
 | 
			
		|||
  request_timeout: 3000
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
async function loadActorUrlOrGetFromWebfinger (uri: string) {
 | 
			
		||||
async function loadActorUrlOrGetFromWebfinger (uriArg: string) {
 | 
			
		||||
  // Handle strings like @toto@example.com
 | 
			
		||||
  const uri = uriArg.startsWith('@') ? uriArg.slice(1) : uriArg
 | 
			
		||||
 | 
			
		||||
  const [ name, host ] = uri.split('@')
 | 
			
		||||
  let actor: ActorModel
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue