Skip to content

Commit d379238

Browse files
committed
feat: add hideuri
1 parent 795ea82 commit d379238

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Type: `object`
4747
Type: `string`
4848

4949
Service to use for shortening links. Defaults to `isgd`
50-
Available providers: `''isgd' | 'cdpt' | 'vgd' | '4hnet' | 'tinube' | 'rbgy' | 'vurl' | 'haha' | 'pwm' | 'cya'`
50+
Available providers: `''isgd' | 'cdpt' | 'vgd' | '4hnet' | 'tinube' | 'rbgy' | 'vurl' | 'haha' | 'pwm' | 'cya' | 'hideuri`
5151

5252
##### timeout
5353

@@ -71,6 +71,7 @@ Url shortner supports the following providers.
7171
| pwn.se | ✔️ |
7272
| haha.se | ✔️ |
7373
| cya.se | ✔️ |
74+
| hideuri.com | ✔️ |
7475

7576
## Contributing
7677

src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from 'axios';
22

33

44

5-
type providers = 'isgd' | 'cdpt' | 'vgd' | '4hnet' | 'tinube' | 'rbgy' | 'vurl' | 'haha' | 'pwm' | 'cya';
5+
type providers = 'isgd' | 'cdpt' | 'vgd' | '4hnet' | 'tinube' | 'rbgy' | 'vurl' | 'haha' | 'pwm' | 'cya' | 'hideuri';
66

77
/**
88
*
@@ -59,6 +59,8 @@ function responseMap(response: Record<any, any>, longUrl: string,provider: provi
5959
return { longUrl, shortUrl: response.data.short };
6060
} else if (response.data?.short_url) {
6161
return { longUrl, shortUrl: response.data.short_url };
62+
} else if (response.data?.result_url) {
63+
return { longUrl, shortUrl: response.data.result_url };
6264
}
6365
}
6466

@@ -143,6 +145,14 @@ const ValidProviders: Record<string, IProviders> = {
143145
},
144146
},
145147

148+
hideuri: {
149+
url: 'https://hideuri.com/api/v1/shorten',
150+
method: 'post',
151+
body: (val: string) => {
152+
return { url: val };
153+
},
154+
},
155+
146156
rbgy: {
147157
url: 'https://free-url-shortener.rb.gy/shorten',
148158
method: 'post',

test/index.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ describe('should get a shortened url', () => {
2323
expect(response.shortUrl).toMatch(/^https:\/\/4h.net\//);
2424
});
2525

26+
it('should get shortened url with hideuri.com', async () => {
27+
const response = await minify(url, { provider: 'hideuri' });
28+
expect(response.shortUrl).toMatch(/^https:\/\/hideuri.com\//);
29+
});
30+
2631
it('should get shortened url with tinu.be', async () => {
2732
const response = await minify(url, { provider: 'tinube' });
2833
expect(response.shortUrl).toMatch(/^https:\/\/tinu.be\//);

0 commit comments

Comments
 (0)