Skip to content

Commit

Permalink
fix xiami playing problem (protocol relative url)
Browse files Browse the repository at this point in the history
  • Loading branch information
listen1 committed Apr 23, 2018
1 parent 4ea3a1c commit fd68df5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Listen 1 (Chrome Extension) V1.5.2
Listen 1 (Chrome Extension) V1.6.0
==========
最后更新于2018年02月18日
最后更新于2018年04月23日

[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)

Expand Down Expand Up @@ -45,6 +45,9 @@ Firefox打包安装
更新日志
-------

`2018-04-23`
* 修复虾米音乐无法播放的问题

`2018-02-18`

* 修复无法创建歌单的bug
Expand Down
12 changes: 9 additions & 3 deletions js/provider/xiami.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ var xiami = (function() {
return unescape(s.join('')).replace(/\^/g, '0');
}

function handleProtocolRelativeUrl(url){
var regex = /^.*?\/\//;
var result = url.replace(regex, 'http://');
return result;
}

function xm_retina_url(s){
if (s.slice(-6, -4) == '_1') {
return s.slice(0, -6) + s.slice(-4);
Expand All @@ -56,7 +62,7 @@ var xiami = (function() {
'id': '',
'source_url': ''
};
default_playlist.cover_img_url = $(this).find('img')[0].src;
default_playlist.cover_img_url = handleProtocolRelativeUrl($(this).find('img')[0].src);
default_playlist.title = $(this).find('h3 a')[0].title;
var xiami_url = $(this).find('h3 a')[0].href;
var list_id = xiami_url.split('?')[0].split('/').pop()
Expand Down Expand Up @@ -115,8 +121,8 @@ var xiami = (function() {
return;
}
var location = data.data.trackList[0].location;
sound.url = caesar(location);
track.img_url = xm_retina_url(data.data.trackList[0].pic);
sound.url = handleProtocolRelativeUrl(caesar(location));
track.img_url = xm_retina_url(handleProtocolRelativeUrl(data.data.trackList[0].pic));
track.album = data.data.trackList[0].album_name;
track.album_id = 'xmalbum_' + data.data.trackList[0].album_id;
track.lyric_url = data.data.trackList[0].lyric_url;
Expand Down
2 changes: 1 addition & 1 deletion listen1.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ <h3 class="masthead-brand" ng-click="showTag(2)">Listen 1</h3>
<div class="settings-content">
<p> Listen 1 主页: <a href="http://listen1.github.io/listen1/" target="_blank"> http://listen1.github.io/listen1/ </a> </p>
<p> Listen 1 邮箱: [email protected] </p>
<p> 当前版本 1.5.2 (本软件基于MIT协议开源免费)</p>
<p> 当前版本 1.6.0 (本软件基于MIT协议开源免费)</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"manifest_version": 2,
"name": "Listen 1",
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"version": "1.5.2",
"version": "1.6.0",
"web_accessible_resources": [ "images/*" ],
"content_scripts": [{
"matches": ["https://listen1.github.io/listen1/*"],
Expand Down
2 changes: 1 addition & 1 deletion manifest_firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"manifest_version": 2,
"name": "Listen 1",
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"version": "1.5.2",
"version": "1.6.0",
"web_accessible_resources": [ "images/*" ],
"content_scripts": [{
"matches": ["https://listen1.github.io/listen1/*"],
Expand Down

0 comments on commit fd68df5

Please sign in to comment.