Skip to content

Commit

Permalink
Use encodeURIComponent for t.cn API (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
gucong3000 authored Apr 8, 2018
1 parent 1b185b1 commit 941d3b5
Show file tree
Hide file tree
Showing 4 changed files with 1,077 additions and 1,225 deletions.
14 changes: 7 additions & 7 deletions lib/short-doc-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ function shortUrl (url) {
return Promise.resolve(shorturlCache[urlLowerCase]);
}

if (!inGFW) {
if (inGFW) {
return got(`http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578&url_long=${encodeURIComponent(url)}`, {
json: true,
}).then(result => {
return result.body[0].url_short;
});
} else {
return googl.shorten(url);
}

return got(`http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578&url_long=${url}`, {
json: true,
}).then(result => {
return result.body[0].url_short;
});
}

module.exports = function (errors) {
Expand Down
74 changes: 0 additions & 74 deletions lib/shorturl.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,6 @@
"https://github.com/adalbertoteixeira/eslint-plugin-react-custom-rules/blob/head/docs/rules/actions-export-pattern.md#readme": "https://goo.gl/GvZfgJ",
"https://github.com/adalbertoteixeira/eslint-plugin-react-custom-rules/blob/head/docs/rules/react-directive-no-value-prop.md#readme": "https://goo.gl/zUYpoS",
"https://github.com/adalbertoteixeira/eslint-plugin-react-custom-rules/blob/head/docs/rules/selectors-default-export-only.md#readme": "https://goo.gl/amhW9v",
"https://github.com/airbnb/eslint-plugin-react-with-styles/blob/head/docs/rules/cssnortl-only.md#readme": "https://goo.gl/C7fGYP",
"https://github.com/airbnb/eslint-plugin-react-with-styles/blob/head/docs/rules/no-unused-styles.md#readme": "https://goo.gl/uvGU2A",
"https://github.com/airbnb/eslint-plugin-react-with-styles/blob/head/docs/rules/only-spread-css.md#readme": "https://goo.gl/PWNQRc",
"https://github.com/alecxe/eslint-plugin-protractor/blob/head/docs/rules/array-callback-return.md#readme": "https://goo.gl/EeXnuS",
Expand Down Expand Up @@ -826,7 +825,6 @@
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/extensions.md#readme": "https://goo.gl/BwY9j4",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/first.md#readme": "https://goo.gl/KMwtL4",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/group-exports.md#readme": "https://goo.gl/fD8wrd",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/imports-first.md#readme": "https://goo.gl/pNnAij",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/max-dependencies.md#readme": "https://goo.gl/qJi4Ht",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/named.md#readme": "https://goo.gl/aKZ27q",
"https://github.com/benmosher/eslint-plugin-import/blob/head/docs/rules/namespace.md#readme": "https://goo.gl/Rz7koG",
Expand Down Expand Up @@ -988,7 +986,6 @@
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/connect-prefer-minimum-two-arguments.md#readme": "https://goo.gl/exGr6j",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/connect-prefer-named-arguments.md#readme": "https://goo.gl/drvRin",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/maodispatchtoprops-prefer-shorthand.md#readme": "https://goo.gl/LzxqPU",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/mapdispatchtoprops-prefer-object.md#readme": "https://goo.gl/w7ZS81",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/mapdispatchtoprops-prefer-parameters-names.md#readme": "https://goo.gl/jxBxN2",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/mapdispatchtoprops-returns-object.md#readme": "https://goo.gl/m1vXfH",
"https://github.com/dianasuvorova/eslint-plugin-react-redux/blob/head/docs/rules/mapstatetoprops-no-store.md#readme": "https://goo.gl/WcrTbN",
Expand Down Expand Up @@ -1039,7 +1036,6 @@
"https://github.com/ember-cli/eslint-plugin-ember/blob/head/docs/rules/routes-segments-snake-case.md#readme": "https://goo.gl/KmMKT9",
"https://github.com/ember-cli/eslint-plugin-ember/blob/head/docs/rules/use-brace-expansion.md#readme": "https://goo.gl/8X6uJT",
"https://github.com/ember-cli/eslint-plugin-ember/blob/head/docs/rules/use-ember-get-and-set.md#readme": "https://goo.gl/CcasXb",
"https://github.com/eslint-plugins/eslint-plugin-lean-imports/blob/head/docs/rules/import.md#readme": "https://goo.gl/vdJZGV",
"https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/head/docs/rules/accessible-emoji.md#readme": "https://goo.gl/6unhWA",
"https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/head/docs/rules/alt-text.md#readme": "https://goo.gl/oNf4vz",
"https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/head/docs/rules/anchor-has-content.md#readme": "https://goo.gl/dh1TRz",
Expand Down Expand Up @@ -1152,66 +1148,6 @@
"https://github.com/gillespie59/eslint-plugin-angular/blob/head/docs/rules/value-name.md#readme": "https://goo.gl/1RpHBB",
"https://github.com/gillespie59/eslint-plugin-angular/blob/head/docs/rules/watchers-execution.md#readme": "https://goo.gl/U5vzqB",
"https://github.com/gillespie59/eslint-plugin-angular/blob/head/docs/rules/window-service.md#readme": "https://goo.gl/CEd7Xi",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/angularelement.md#readme": "https://goo.gl/LS8xsD",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/avoid-scope-typos.md#readme": "https://goo.gl/opjWSb",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/component-limit.md#readme": "https://goo.gl/kdXRb3",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/component-name.md#readme": "https://goo.gl/3xq5U6",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/constant-name.md#readme": "https://goo.gl/N4f1Wf",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/controller-as-route.md#readme": "https://goo.gl/mu4UXh",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/controller-as-vm.md#readme": "https://goo.gl/QvwoBM",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/controller-as.md#readme": "https://goo.gl/6MqFG9",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/controller-name.md#readme": "https://goo.gl/Hw7X2C",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/deferred.md#readme": "https://goo.gl/4UZW3U",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/definedundefined.md#readme": "https://goo.gl/mybkvG",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/di-order.md#readme": "https://goo.gl/9tuLXE",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/di-unused.md#readme": "https://goo.gl/ru1RpK",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/di.md#readme": "https://goo.gl/jB6p3y",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/directive-name.md#readme": "https://goo.gl/GBoFiF",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/directive-restrict.md#readme": "https://goo.gl/wz73YG",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/document-service.md#readme": "https://goo.gl/F7sQjx",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/dumb-inject.md#readme": "https://goo.gl/mFtMr7",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/empty-controller.md#readme": "https://goo.gl/aPqR6W",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/factory-name.md#readme": "https://goo.gl/LrXtcD",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/file-name.md#readme": "https://goo.gl/bf2ZFE",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/filter-name.md#readme": "https://goo.gl/DAPgsB",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/foreach.md#readme": "https://goo.gl/7aGL8t",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/function-type.md#readme": "https://goo.gl/Dp2bJk",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/interval-service.md#readme": "https://goo.gl/5mFL7r",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/json-functions.md#readme": "https://goo.gl/X8c2Eb",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/log.md#readme": "https://goo.gl/M7fUXp",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/module-dependency-order.md#readme": "https://goo.gl/7jw6rr",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/module-getter.md#readme": "https://goo.gl/NiZChv",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/module-name.md#readme": "https://goo.gl/Shj1mX",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/module-setter.md#readme": "https://goo.gl/5wbWLw",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-angular-mock.md#readme": "https://goo.gl/kD9PNt",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-controller.md#readme": "https://goo.gl/p9nuqj",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-cookiestore.md#readme": "https://goo.gl/DajpqD",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-directive-replace.md#readme": "https://goo.gl/x3uVF5",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-http-callback.md#readme": "https://goo.gl/8oSqw9",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-inline-template.md#readme": "https://goo.gl/spKYsh",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-jquery-angularelement.md#readme": "https://goo.gl/bA3ATK",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-private-call.md#readme": "https://goo.gl/6nhmoV",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-run-logic.md#readme": "https://goo.gl/CXitob",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-service-method.md#readme": "https://goo.gl/4kF3ib",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/no-services.md#readme": "https://goo.gl/c7s9xA",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/on-destroy.md#readme": "https://goo.gl/ZZirCS",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/on-watch.md#readme": "https://goo.gl/kw8JvG",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/one-dependency-per-line.md#readme": "https://goo.gl/p6AUJN",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/prefer-component.md#readme": "https://goo.gl/C9xkJS",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/provider-name.md#readme": "https://goo.gl/GYBCLU",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/rest-service.md#readme": "https://goo.gl/AsjG3v",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/service-name.md#readme": "https://goo.gl/Mi5ssJ",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/timeout-service.md#readme": "https://goo.gl/pczKfp",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-array.md#readme": "https://goo.gl/VT4Zg1",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-date.md#readme": "https://goo.gl/XMWqaR",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-function.md#readme": "https://goo.gl/qnHVkr",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-number.md#readme": "https://goo.gl/5YotDP",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-object.md#readme": "https://goo.gl/rDqpC5",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/typecheck-string.md#readme": "https://goo.gl/ERt8MT",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/value-name.md#readme": "https://goo.gl/BLNgm7",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/watchers-execution.md#readme": "https://goo.gl/9DYRUu",
"https://github.com/gillespie59/eslint-plugin-angularjs/blob/head/docs/rules/window-service.md#readme": "https://goo.gl/ekoNb7",
"https://github.com/gwmccull/eslint-plugin-build-app/blob/head/docs/rules/jsx-require-prop-accessibility-label.md#readme": "https://goo.gl/WXk3fb",
"https://github.com/hijup/eslint-plugin-hijup/blob/head/docs/rules/explicit-button-type.md#readme": "https://goo.gl/wFd6gw",
"https://github.com/hijup/eslint-plugin-hijup/blob/head/docs/rules/no-wrap-template-string.md#readme": "https://goo.gl/oSGhxB",
"https://github.com/ideadapt/eslint-plugin-jsapps/blob/head/docs/rules/expect-length.md#readme": "https://goo.gl/tPuEt7",
Expand Down Expand Up @@ -1323,7 +1259,6 @@
"https://github.com/jest-community/eslint-plugin-jest/blob/head/docs/rules/valid-expect.md#readme": "https://goo.gl/9mzhsf",
"https://github.com/keyfoxth/eslint-plugin-url/blob/head/docs/rules/no-absolute-url.md#readme": "https://goo.gl/q2d77o",
"https://github.com/keyfoxth/eslint-plugin-url/blob/head/docs/rules/no-http.md#readme": "https://goo.gl/ZfMB5Y",
"https://github.com/khan/eslint-plugin-react-native-animation-linter/blob/head/docs/rules/must-tear-down-animations.md#readme": "https://goo.gl/vPNW78",
"https://github.com/lo1tuma/eslint-plugin-mocha/blob/head/docs/rules/handle-done-callback.md#readme": "https://goo.gl/NsqZr5",
"https://github.com/lo1tuma/eslint-plugin-mocha/blob/head/docs/rules/max-top-level-suites.md#readme": "https://goo.gl/36T6uo",
"https://github.com/lo1tuma/eslint-plugin-mocha/blob/head/docs/rules/no-exclusive-tests.md#readme": "https://goo.gl/dLKKBy",
Expand All @@ -1350,11 +1285,8 @@
"https://github.com/lukeapage/eslint-plugin-switch-case/blob/head/docs/rules/newline-between-switch-case.md#readme": "https://goo.gl/gZ2giY",
"https://github.com/lukeapage/eslint-plugin-switch-case/blob/head/docs/rules/no-case-curly.md#readme": "https://goo.gl/NJYBGw",
"https://github.com/ma27/eslint-plugin-varspacing/blob/head/docs/rules/var-spacing.md#readme": "https://goo.gl/qzgjrA",
"https://github.com/maikziemer/eslint-plugin-extras/blob/head/docs/rules/sort-named-imports.md#readme": "https://goo.gl/acJG2H",
"https://github.com/manovotny/eslint-plugin-get-off-my-lawn/blob/head/docs/rules/prefer-arrow-functions.md#readme": "https://goo.gl/fJXthJ",
"https://github.com/marudor/eslint-plugin-class-property/blob/head/docs/rules/class-property-semicolon.md#readme": "https://goo.gl/99YfKL",
"https://github.com/meetup/eslint-plugin-meetup/blob/head/docs/rules/trn.md#readme": "https://goo.gl/1cX4Nc",
"https://github.com/mitmaro/eslint-plugin-strict-newline/blob/head/docs/rules/strict-newline.md#readme": "https://goo.gl/6MHYrz",
"https://github.com/mysticatea/eslint-plugin-es/blob/head/docs/rules/no-accessor-properties.md#readme": "https://goo.gl/dbL4ug",
"https://github.com/mysticatea/eslint-plugin-es/blob/head/docs/rules/no-arrow-functions.md#readme": "https://goo.gl/pBUeTe",
"https://github.com/mysticatea/eslint-plugin-es/blob/head/docs/rules/no-async-functions.md#readme": "https://goo.gl/m2hv71",
Expand Down Expand Up @@ -1514,14 +1446,9 @@
"https://github.com/platinumazure/eslint-plugin-qunit/blob/head/docs/rules/no-throws-string.md#readme": "https://goo.gl/6SNQQs",
"https://github.com/platinumazure/eslint-plugin-qunit/blob/head/docs/rules/require-expect.md#readme": "https://goo.gl/yBukbV",
"https://github.com/platinumazure/eslint-plugin-qunit/blob/head/docs/rules/resolve-async.md#readme": "https://goo.gl/vo6U9V",
"https://github.com/pstephenwille/no-http-protocol/blob/head/docs/rules/no-http-protocol.md#readme": "https://goo.gl/QDYUDT",
"https://github.com/rantanen/eslint-plugin-xss/blob/head/docs/rules/no-location-href-assign.md#readme": "https://goo.gl/FJUEjN",
"https://github.com/rantanen/eslint-plugin-xss/blob/head/docs/rules/no-mixed-html.md#readme": "https://goo.gl/v2twjf",
"https://github.com/regru/eslint-plugin-regru/blob/head/docs/rules/no-space-in-parens.md#readme": "https://goo.gl/AGbene",
"https://github.com/santi/eslint-plugin-robber-language/blob/head/docs/rules/functions.md#readme": "https://goo.gl/VjE325",
"https://github.com/santi/eslint-plugin-robber-language/blob/head/docs/rules/import.md#readme": "https://goo.gl/uYVmXU",
"https://github.com/santi/eslint-plugin-robber-language/blob/head/docs/rules/objects.md#readme": "https://goo.gl/v5Z4WT",
"https://github.com/santi/eslint-plugin-robber-language/blob/head/docs/rules/variables.md#readme": "https://goo.gl/cU2u6i",
"https://github.com/shopify/eslint-plugin-shopify/blob/head/docs/rules/binary-assignment-parens.md#readme": "https://goo.gl/MSWhNy",
"https://github.com/shopify/eslint-plugin-shopify/blob/head/docs/rules/class-property-semi.md#readme": "https://goo.gl/Rs2bN8",
"https://github.com/shopify/eslint-plugin-shopify/blob/head/docs/rules/jquery-dollar-sign-reference.md#readme": "https://goo.gl/M5QhWt",
Expand Down Expand Up @@ -1828,7 +1755,6 @@
"https://github.com/yannickcr/eslint-plugin-react/blob/head/docs/rules/sort-prop-types.md#readme": "https://goo.gl/BL5UNW",
"https://github.com/yannickcr/eslint-plugin-react/blob/head/docs/rules/style-prop-object.md#readme": "https://goo.gl/v174wf",
"https://github.com/yannickcr/eslint-plugin-react/blob/head/docs/rules/void-dom-elements-no-children.md#readme": "https://goo.gl/sLWs2a",
"https://github.com/yoast/eslint-plugin/blob/head/docs/rules/comment-starting-capital.md#readme": "https://goo.gl/tv33Y3",
"https://github.com/zeronone/eslint-plugin-const-immutable/blob/head/docs/rules/no-mutation.md#readme": "https://goo.gl/XQAmgA",
"https://palantir.github.io/tslint/rules/adjacent-overload-signatures/": "https://goo.gl/vUMYyv",
"https://palantir.github.io/tslint/rules/align/": "https://goo.gl/9XLVxq",
Expand Down
Loading

0 comments on commit 941d3b5

Please sign in to comment.