fedimbed: split mastodon regex
This commit is contained in:
		
							parent
							
								
									3f39f840ff
								
							
						
					
					
						commit
						909bec67e1
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
					@ -9,7 +9,8 @@ const FRIENDLY_USERAGENT =
 | 
				
			||||||
const URLS_REGEX = /(?:\s|^)(https?:\/\/[^\s<]+[^<.,:;"'\]\s])/g;
 | 
					const URLS_REGEX = /(?:\s|^)(https?:\/\/[^\s<]+[^<.,:;"'\]\s])/g;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PATH_REGEX = {
 | 
					const PATH_REGEX = {
 | 
				
			||||||
  mastodon: /^\/@?(.+?)\/(statuses\/)?\d+\/?/,
 | 
					  mastodon: /^\/@(.+?)\/\d+\/?/,
 | 
				
			||||||
 | 
					  mastodon2: /^\/(.+?)\/statuses\/\d+\/?/,
 | 
				
			||||||
  pleroma:
 | 
					  pleroma:
 | 
				
			||||||
    /^\/objects\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/?/,
 | 
					    /^\/objects\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/?/,
 | 
				
			||||||
  pleroma2: /^\/notice\/[A-Za-z0-9]+\/?/,
 | 
					  pleroma2: /^\/notice\/[A-Za-z0-9]+\/?/,
 | 
				
			||||||
| 
						 | 
					@ -74,7 +75,6 @@ async function processUrl(msg, url) {
 | 
				
			||||||
    headers: {
 | 
					    headers: {
 | 
				
			||||||
      "User-Agent": FRIENDLY_USERAGENT,
 | 
					      "User-Agent": FRIENDLY_USERAGENT,
 | 
				
			||||||
      Accept: "application/activity+json",
 | 
					      Accept: "application/activity+json",
 | 
				
			||||||
      "Content-Type": "application/activity+json",
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
    .then((res) => res.json())
 | 
					    .then((res) => res.json())
 | 
				
			||||||
| 
						 | 
					@ -154,7 +154,6 @@ async function processUrl(msg, url) {
 | 
				
			||||||
      headers: {
 | 
					      headers: {
 | 
				
			||||||
        "User-Agent": FRIENDLY_USERAGENT,
 | 
					        "User-Agent": FRIENDLY_USERAGENT,
 | 
				
			||||||
        Accept: "application/activity+json",
 | 
					        Accept: "application/activity+json",
 | 
				
			||||||
        "Content-Type": "application/activity+json",
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
      .then((res) => res.json())
 | 
					      .then((res) => res.json())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue