Skip to content

Commit ffc6e16

Browse files
committed
fix shortlink
1 parent 3a9a642 commit ffc6e16

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

dist/affixingassistant.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewcontroller.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -822,17 +822,19 @@ class ViewController {
822822
getShortURLThenOpenLinkView() {
823823
if (this.requestSafetyFlag) return;
824824
this.requestSafetyFlag = true;
825-
let bitlyUrl = 'https://api-ssl.bitly.com/v3/shorten?'
826-
+ 'access_token=85f88da122ee5904f211eea3714d900570b7cb1f&longUrl='
827-
+ encodeURIComponent(window.location.href)
828825
let vc = this;
829826
$.ajax({
830-
type: "GET",
831-
url: bitlyUrl,
827+
type: 'POST',
828+
headers: {
829+
'Authorization': 'Bearer 85f88da122ee5904f211eea3714d900570b7cb1f',
830+
'Content-Type': 'application/json'
831+
},
832+
url: 'https://api-ssl.bitly.com/v4/shorten',
833+
dataType: 'json',
834+
data: JSON.stringify({ long_url: encodeURI(window.location.href) }),
832835
success: function (res) {
833836
vc.requestSafetyFlag = false;
834-
let shortlink = (res.data && res.data.url) ?
835-
res.data.url : null;
837+
let shortlink = res ? res.link : null;
836838
vc.openGetLinkView({
837839
shouldAnimate: true,
838840
shortLink: shortlink

0 commit comments

Comments
 (0)