├── CNAME ├── QR.png ├── moefm-html5-icomoon.ttf ├── oauth_callback.html ├── README.md ├── qr.php ├── hqac ├── README.md └── index.php ├── background └── index.html ├── sha1.js ├── oauth.js ├── LICENSE └── index.html /CNAME: -------------------------------------------------------------------------------- 1 | moefm.ccloli.com -------------------------------------------------------------------------------- /QR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccloli/moefm-html5-project/HEAD/QR.png -------------------------------------------------------------------------------- /moefm-html5-icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccloli/moefm-html5-project/HEAD/moefm-html5-icomoon.ttf -------------------------------------------------------------------------------- /oauth_callback.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OAuth Callback 6 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | moefm-html5-project 2 | =================== 3 | 4 | 萌否电台 HTML5 版本(非官方) 5 | 6 | # 7 | 8 | 许可协议附注 9 | ------------------- 10 | 11 | This project is under license of GPLv3. 12 | 13 | ### oauth.js 14 | 15 | Source: http://oauth.googlecode.com/svn/code/javascript/oauth.js 16 | 17 | Project Home: http://oauth.googlecode.com/ 18 | 19 | Copyright 2008 Netflix, Inc. 20 | 21 | Licensed under the Apache License, Version 2.0 (the "License") 22 | 23 | http://www.apache.org/licenses/LICENSE-2.0 24 | 25 | ### sha1.js 26 | 27 | Source: http://pajhome.org.uk/crypt/md5/sha1.js 28 | 29 | Project Home: http://pajhome.org.uk/crypt/md5/ 30 | 31 | Copyright 2000-2002 Paul Johnston 32 | 33 | Licensed under the BSD License 34 | 35 | ### qr.php 36 | 37 | Source: http://www.daimajiayuan.com/sitejs-16952-1.html 38 | 39 | API: http://chart.apis.google.com 40 | 41 | 版本更新说明 42 | ------------------- 43 | http://moefou.org/topic/1914 -------------------------------------------------------------------------------- /qr.php: -------------------------------------------------------------------------------- 1 | $value){ 17 | $data_Array[]=$key.'='.$value; 18 | } 19 | $data=implode("&",$data_Array); 20 | $ch=curl_init(); 21 | curl_setopt($ch, CURLOPT_POST, 1); 22 | curl_setopt($ch, CURLOPT_HEADER, 0); 23 | curl_setopt($ch, CURLOPT_URL, $url); 24 | curl_setopt($ch, CURLOPT_POSTFIELDS,$data); 25 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 26 | $result=curl_exec($ch); 27 | //echo ""; 注意,不写header的写法 28 | return $result; 29 | } 30 | ?> -------------------------------------------------------------------------------- /hqac/README.md: -------------------------------------------------------------------------------- 1 | MoeFM High-Quality Audio Checker 2 | ==================== 3 | 4 | MoeFM HTML5 Project Subject 5 | 6 | License: GPLv3 7 | 8 | More about this: http://moefou.org/topic/1939 9 | 10 | ## 调用参数 11 | 12 | ### url 13 | 14 | 萌否电台的音频文件位址(无论音质,可不含 `http://` 前缀)。 15 | 16 | Method: `GET` 17 | Required: `true` 18 | 19 | 示例: 20 | ``` 21 | url=http://nyan.90g.org/9/f/6d/ab2941597177f67434cb0a007c35f759_320.mp3 22 | url=nyan.90g.org/e/6/57/c6d3aab94862090b6517708c2bdea56f.mp3 23 | ``` 24 | 25 | ### callback 26 | 27 | JSONP 的返回函数名,若指定该参数,则会以 `fnCallback({...})` 的形式返回数据。 28 | 29 | Method: `GET` 30 | Required: `false` 31 | 32 | 示例: 33 | ``` 34 | callback=fnCallback 35 | ``` 36 | 37 | ## 返回数据 38 | 39 | 若未指定 `callback` 参数,则返回数据为 JSON 格式,无论错误码如何均返回 `200 OK`。 40 | 41 | 示例(未指定 `callback`): 42 | 43 | ```json 44 | { // 这是返回正常的数据 45 | "request": "http:\/\/nyan.90g.org\/9\/f\/6d\/ab2941597177f67434cb0a007c35f759_320.mp3", // 提交请求的 URL 地址 46 | "response": { 47 | "64":{ // 64Kbps 音质的数据,Object 数据格式下同 48 | "exist": 1, // 是否存在该码率文件,1 为存在,0 为不存在 49 | "url": "http:\/\/nyan.90g.org\/9\/f\/6d\/ab2941597177f67434cb0a007c35f759.mp3" // 该码率的理论文件位址(即使文件不存在) 50 | }, 51 | "128":{ ... }, // 128Kbps 音质的数据 52 | "192":{ ... }, // 192Kbps 音质的数据 53 | "320":{ ... }, // 320Kbps 音质的数据 54 | }, 55 | "error": 0 // 错误码,0 为返回正常,其他为返回出错 56 | } 57 | ``` 58 | 59 | ```json 60 | { // 这是返回异常的数据(目前仅有判断 URL 是否正常之功能) 61 | "request": "http://moefm.ccloli.com", 62 | "error": 1, 63 | "error_msg": "URL\\u0020\\u4e0d\\u5339\\u914d" 64 | } 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /background/index.html: -------------------------------------------------------------------------------- 1 | {"background_list":["http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m3gnxwdj212w0ob15j.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m3tgfjdj212w0ob0zs.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m40yyoyj20xc0irdlp.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m46prxyj212w0ocdpd.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m4d7jekj212w0o2dsb.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m4i3rb8j212w0rkgxl.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m4p7b3zj212w0obn5f.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m4u42ffj20sg0lctc8.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m507so1j212w0r949k.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m58eirrj212w0lwn4l.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m5dsk2jj212w0lwdm9.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m5mt4qfj20zk0qotg7.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m5sqhayj212w0lwn6o.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m5ztec0j212w0lwn24.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m65hy6cj20xc0npn8u.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m6brd0uj212w0ob47n.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m6gv38aj212w0lwgwh.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m6l3dufj20zk0k0qdg.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m6rsxcnj20rs0jm43p.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m6xaa8mj20rs0dn471.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m733829j212w0id7f0.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m79emxsj212w0rcqix.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m7eybt4j212w0obtgw.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m7k06l8j212w0oddog.jpg","http://ww1.sinaimg.cn/large/8c5fbe53gw1ed1m7tqsioj212w0lw444.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m80sk10j20xc0nlk45.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m85n94sj212w0lw7bv.jpg","http://ww2.sinaimg.cn/large/8c5fbe53gw1ed1m89vjy2j212w0rjgun.jpg","http://ww3.sinaimg.cn/large/8c5fbe53gw1ed1m8f5pvxj20uk0goah6.jpg","http://ww4.sinaimg.cn/large/8c5fbe53gw1ed1m8smenbj212w0lwws9.jpg"]} 2 | -------------------------------------------------------------------------------- /hqac/index.php: -------------------------------------------------------------------------------- 1 | $_GET['url'], 50 | 'response' => array( 51 | '64' => array( 52 | 'exist' => $exist_64, 53 | 'url' => $url_64 54 | ), 55 | '128' => array( 56 | 'exist' => $exist_128, 57 | 'url' => $url_128 58 | ), 59 | '192' => array( 60 | 'exist' => $exist_192, 61 | 'url' => $url_192 62 | ), 63 | '320' => array( 64 | 'exist' => $exist_320, 65 | 'url' => $url_320 66 | ) 67 | ), 68 | 'error' => 0, 69 | 'error_msg' => '获取成功' 70 | ); 71 | $res = json_encode($data); 72 | if (!empty($callback)) $res = $callback . '(' . $res . ')'; 73 | echo $res; 74 | } 75 | else { 76 | $data = array( 77 | 'request' => $_GET['url'], 78 | 'error' => 1, 79 | 'error_msg' => 'URL 不匹配' 80 | ); 81 | $res = json_encode($data); 82 | if (!empty($callback)) $res = $callback . '(' . $res . ')'; 83 | echo $res; 84 | } -------------------------------------------------------------------------------- /sha1.js: -------------------------------------------------------------------------------- 1 | /* Source: http://oauth.googlecode.com/svn/code/javascript/sha1.js */ 2 | 3 | /* 4 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined 5 | * in FIPS PUB 180-1 6 | * Version 2.1a Copyright Paul Johnston 2000 - 2002. 7 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 8 | * Distributed under the BSD License 9 | * See http://pajhome.org.uk/crypt/md5 for details. 10 | */ 11 | 12 | /* 13 | * Configurable variables. You may need to tweak these to be compatible with 14 | * the server-side, but the defaults work in most cases. 15 | */ 16 | var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ 17 | var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ 18 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ 19 | 20 | /* 21 | * These are the functions you'll usually want to call 22 | * They take string arguments and return either hex or base-64 encoded strings 23 | */ 24 | function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} 25 | function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} 26 | function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} 27 | function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} 28 | function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} 29 | function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} 30 | 31 | /* 32 | * Perform a simple self-test to see if the VM is working 33 | */ 34 | function sha1_vm_test() 35 | { 36 | return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; 37 | } 38 | 39 | /* 40 | * Calculate the SHA-1 of an array of big-endian words, and a bit length 41 | */ 42 | function core_sha1(x, len) 43 | { 44 | /* append padding */ 45 | x[len >> 5] |= 0x80 << (24 - len % 32); 46 | x[((len + 64 >> 9) << 4) + 15] = len; 47 | 48 | var w = Array(80); 49 | var a = 1732584193; 50 | var b = -271733879; 51 | var c = -1732584194; 52 | var d = 271733878; 53 | var e = -1009589776; 54 | 55 | for(var i = 0; i < x.length; i += 16) 56 | { 57 | var olda = a; 58 | var oldb = b; 59 | var oldc = c; 60 | var oldd = d; 61 | var olde = e; 62 | 63 | for(var j = 0; j < 80; j++) 64 | { 65 | if(j < 16) w[j] = x[i + j]; 66 | else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); 67 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), 68 | safe_add(safe_add(e, w[j]), sha1_kt(j))); 69 | e = d; 70 | d = c; 71 | c = rol(b, 30); 72 | b = a; 73 | a = t; 74 | } 75 | 76 | a = safe_add(a, olda); 77 | b = safe_add(b, oldb); 78 | c = safe_add(c, oldc); 79 | d = safe_add(d, oldd); 80 | e = safe_add(e, olde); 81 | } 82 | return Array(a, b, c, d, e); 83 | 84 | } 85 | 86 | /* 87 | * Perform the appropriate triplet combination function for the current 88 | * iteration 89 | */ 90 | function sha1_ft(t, b, c, d) 91 | { 92 | if(t < 20) return (b & c) | ((~b) & d); 93 | if(t < 40) return b ^ c ^ d; 94 | if(t < 60) return (b & c) | (b & d) | (c & d); 95 | return b ^ c ^ d; 96 | } 97 | 98 | /* 99 | * Determine the appropriate additive constant for the current iteration 100 | */ 101 | function sha1_kt(t) 102 | { 103 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : 104 | (t < 60) ? -1894007588 : -899497514; 105 | } 106 | 107 | /* 108 | * Calculate the HMAC-SHA1 of a key and some data 109 | */ 110 | function core_hmac_sha1(key, data) 111 | { 112 | var bkey = str2binb(key); 113 | if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); 114 | 115 | var ipad = Array(16), opad = Array(16); 116 | for(var i = 0; i < 16; i++) 117 | { 118 | ipad[i] = bkey[i] ^ 0x36363636; 119 | opad[i] = bkey[i] ^ 0x5C5C5C5C; 120 | } 121 | 122 | var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); 123 | return core_sha1(opad.concat(hash), 512 + 160); 124 | } 125 | 126 | /* 127 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally 128 | * to work around bugs in some JS interpreters. 129 | */ 130 | function safe_add(x, y) 131 | { 132 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); 133 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 134 | return (msw << 16) | (lsw & 0xFFFF); 135 | } 136 | 137 | /* 138 | * Bitwise rotate a 32-bit number to the left. 139 | */ 140 | function rol(num, cnt) 141 | { 142 | return (num << cnt) | (num >>> (32 - cnt)); 143 | } 144 | 145 | /* 146 | * Convert an 8-bit or 16-bit string to an array of big-endian words 147 | * In 8-bit function, characters >255 have their hi-byte silently ignored. 148 | */ 149 | function str2binb(str) 150 | { 151 | var bin = Array(); 152 | var mask = (1 << chrsz) - 1; 153 | for(var i = 0; i < str.length * chrsz; i += chrsz) 154 | bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); 155 | return bin; 156 | } 157 | 158 | /* 159 | * Convert an array of big-endian words to a string 160 | */ 161 | function binb2str(bin) 162 | { 163 | var str = ""; 164 | var mask = (1 << chrsz) - 1; 165 | for(var i = 0; i < bin.length * 32; i += chrsz) 166 | str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); 167 | return str; 168 | } 169 | 170 | /* 171 | * Convert an array of big-endian words to a hex string. 172 | */ 173 | function binb2hex(binarray) 174 | { 175 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; 176 | var str = ""; 177 | for(var i = 0; i < binarray.length * 4; i++) 178 | { 179 | str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + 180 | hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); 181 | } 182 | return str; 183 | } 184 | 185 | /* 186 | * Convert an array of big-endian words to a base-64 string 187 | */ 188 | function binb2b64(binarray) 189 | { 190 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 191 | var str = ""; 192 | for(var i = 0; i < binarray.length * 4; i += 3) 193 | { 194 | var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) 195 | | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) 196 | | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); 197 | for(var j = 0; j < 4; j++) 198 | { 199 | if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; 200 | else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); 201 | } 202 | } 203 | return str; 204 | } 205 | -------------------------------------------------------------------------------- /oauth.js: -------------------------------------------------------------------------------- 1 | /* Source: http://oauth.googlecode.com/svn/code/javascript/oauth.js */ 2 | 3 | /* 4 | * Copyright 2008 Netflix, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* Here's some JavaScript software for implementing OAuth. 20 | 21 | This isn't as useful as you might hope. OAuth is based around 22 | allowing tools and websites to talk to each other. However, 23 | JavaScript running in web browsers is hampered by security 24 | restrictions that prevent code running on one website from 25 | accessing data stored or served on another. 26 | 27 | Before you start hacking, make sure you understand the limitations 28 | posed by cross-domain XMLHttpRequest. 29 | 30 | On the bright side, some platforms use JavaScript as their 31 | language, but enable the programmer to access other web sites. 32 | Examples include Google Gadgets, and Microsoft Vista Sidebar. 33 | For those platforms, this library should come in handy. 34 | */ 35 | 36 | // The HMAC-SHA1 signature method calls b64_hmac_sha1, defined by 37 | // http://pajhome.org.uk/crypt/md5/sha1.js 38 | 39 | /* An OAuth message is represented as an object like this: 40 | {method: "GET", action: "http://server.com/path", parameters: ...} 41 | 42 | The parameters may be either a map {name: value, name2: value2} 43 | or an Array of name-value pairs [[name, value], [name2, value2]]. 44 | The latter representation is more powerful: it supports parameters 45 | in a specific sequence, or several parameters with the same name; 46 | for example [["a", 1], ["b", 2], ["a", 3]]. 47 | 48 | Parameter names and values are NOT percent-encoded in an object. 49 | They must be encoded before transmission and decoded after reception. 50 | For example, this message object: 51 | {method: "GET", action: "http://server/path", parameters: {p: "x y"}} 52 | ... can be transmitted as an HTTP request that begins: 53 | GET /path?p=x%20y HTTP/1.0 54 | (This isn't a valid OAuth request, since it lacks a signature etc.) 55 | Note that the object "x y" is transmitted as x%20y. To encode 56 | parameters, you can call OAuth.addToURL, OAuth.formEncode or 57 | OAuth.getAuthorization. 58 | 59 | This message object model harmonizes with the browser object model for 60 | input elements of an form, whose value property isn't percent encoded. 61 | The browser encodes each value before transmitting it. For example, 62 | see consumer.setInputs in example/consumer.js. 63 | */ 64 | 65 | /* This script needs to know what time it is. By default, it uses the local 66 | clock (new Date), which is apt to be inaccurate in browsers. To do 67 | better, you can load this script from a URL whose query string contains 68 | an oauth_timestamp parameter, whose value is a current Unix timestamp. 69 | For example, when generating the enclosing document using PHP: 70 | 71 | 222 | 223 | 1369 | 1370 | --------------------------------------------------------------------------------