Compare commits

..

4 Commits
0.1.4 ... 0.2.0

Author SHA1 Message Date
Nicolai Ort 72932955d1 🚀RELEASE 0.2.0
continuous-integration/drone/push Build is passing Details
2021-08-14 15:48:18 +02:00
Nicolai Ort 339e2f39d8
Ebay provider resolution 2021-08-14 15:47:58 +02:00
Nicolai Ort 12c6d7e3da
Added ebay provider recognition 2021-08-14 15:47:03 +02:00
Nicolai Ort 1624e666e8
Now recognizing with and without protocol 2021-08-14 15:46:14 +02:00
3 changed files with 25 additions and 2 deletions

View File

@ -2,9 +2,18 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### [0.2.0](https://git.odit.services/kauft.es/linkylinky/compare/0.1.4...0.2.0)
- Added ebay provider recognition [`12c6d7e`](https://git.odit.services/kauft.es/linkylinky/commit/12c6d7e3da5cb4de6a597b4639f313b8e4319646)
- Ebay provider resolution [`339e2f3`](https://git.odit.services/kauft.es/linkylinky/commit/339e2f39d88d42a961e1e495f319dc0663cdc0a6)
- Now recognizing with and without protocol [`1624e66`](https://git.odit.services/kauft.es/linkylinky/commit/1624e666e83e0afe346bcacb105ea1a1535f0690)
#### [0.1.4](https://git.odit.services/kauft.es/linkylinky/compare/0.1.3...0.1.4)
> 14 August 2021
- Added cors [`518aa3e`](https://git.odit.services/kauft.es/linkylinky/commit/518aa3eb08cb72854812130d45b3b89afb074693)
- 🚀RELEASE 0.1.4 [`86f4cd0`](https://git.odit.services/kauft.es/linkylinky/commit/86f4cd00ea517f7e2cacbf69f2163eae597610ee)
#### [0.1.3](https://git.odit.services/kauft.es/linkylinky/compare/0.1.2...0.1.3)

View File

@ -1,6 +1,6 @@
{
"name": "@odit/shortener-backend",
"version": "0.1.4",
"version": "0.2.0",
"main": "index.js",
"license": "MIT",
"private": false,

View File

@ -41,6 +41,11 @@ fastify.get('/ytpl/:id', async (req, res) => {
res.redirect(302, `https://youtube.com/playlist?list=${req.params.id}`)
})
//Automagic ebay item redirects on /e/
fastify.get('/e/:id', async (req, res) => {
res.redirect(302, `https://ebay.de/itm/${req.params.id}`)
})
//Normal shorturls
fastify.get('/:shortcode', async (req, res) => {
const shortcode = req.params.shortcode;
@ -284,7 +289,7 @@ function checkKnownProviders(target) {
target
}
}
const amazonID = target.match(/https?:\/\/(www|smile|)\.?(amazon|smile)\.(de)(?:(?:\/.*\/|\/)(?:dp|gp))(\/product\/|\/)([A-Z0-9]+)/);
const amazonID = target.match(/(?:https?:\/\/|)(www|smile|)\.?(amazon|smile)\.(de)(?:(?:\/.*\/|\/)(?:dp|gp))(\/product\/|\/)([A-Z0-9]+)/);
if (amazonID) {
const shortcode = `a/${amazonID[5]}`
return {
@ -293,6 +298,15 @@ function checkKnownProviders(target) {
target
}
}
const ebayID = target.match(/(?:[ebay]*(?:[\/]|[itm=])|^)([0-9]{9,12})/);
if (ebayID) {
const shortcode = `e/${ebayID[1]}`
return {
url: `${config.getBaseUrl()}/${shortcode}`,
shortcode,
target
}
}
return null;
}