{"id":148002,"date":"2020-08-30T08:53:32","date_gmt":"2020-08-30T00:53:32","guid":{"rendered":"http:\/\/4563.org\/?p=148002"},"modified":"2020-08-30T08:53:32","modified_gmt":"2020-08-30T00:53:32","slug":"onedriveonemanagerherokucfworkers%ef%bc%8c%e7%be%8a%e6%af%9b%e8%a1%ab%e6%96%b0%e7%bb%87%e6%b3%95","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=148002","title":{"rendered":"Onedrive+OneManager+Heroku+CFWorkers\uff0c\u7f8a\u6bdb\u886b\u65b0\u7ec7\u6cd5"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u9038\u7b19<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>Onedrive+OneManager+Heroku+CFWorkers\uff0c\u7f8a\u6bdb\u886b\u65b0\u7ec7\u6cd5<\/h3>\n<p>  \t\tDemo\uff0c\u4e0d\u653e\u3002<br \/>  \u7f51\u7ad9\u4e0b\u8f7d\u94fe\u63a5\u76f4\u63a5\u662fxxx.com\/abc.jpg\uff0c\u6ca1\u6709302\u8df3\u5230\u5fae\u8f6fxxx.sharepoint.com\uff0c\u4e5f\u6ca1\u6709\u53cd\u4ee3xxx.sharepoint.com\u90a3\u6837\u540e\u9762\u4e00\u957f\u4e32\u3002<\/p>\n<p>  \u51c6\u5907\u5de5\u4f5c\uff1a<br \/>  1\uff0c&nbsp; &nbsp; &nbsp; &nbsp; Onedrive\uff0c\u6216Sharepoint<br \/>  \u8fd9\u4e2a\u5927\u5bb6\u6709\u7684\uff0c\u5404\u79cdA1\uff0cE3\uff0cE5\uff0c\u4e16\u7eaa\u3002\uff08Sharepoint\u9ed8\u8ba425T\uff09<br \/>  2\uff0c&nbsp; &nbsp; &nbsp; &nbsp; OneManager\uff0cGithub\u5730\u5740\uff1ahttps:\/\/github.com\/qkqpttgf\/OneManager-php<br \/>  \u57fa\u4e8e\u5404\u79cd\u65e0\u670d\u52a1\u5668\u7684\u5e73\u53f0\uff0c\u6bd4\u5982Heroku\u3001\u817e\u8bafSCF\u3001\u963f\u91ccFC\u3001\u534e\u4e3aFG\u3001\u767e\u5ea6CFC\uff0c\u914d\u7f6e\u90fd\u4fdd\u5b58\u5728\u5176\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u88c5\u5728VPS\u4e0e\u7a7a\u95f4\u91cc\uff0c\u4e0d\u8fc7\u4e3a\u4e86\u4e00\u81f4\uff0c\u7a0b\u5e8f\u4e0d\u56fa\u5b9a\u50a8\u5b58onedrive\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u7f13\u5b58\u6700\u591a1\u5c0f\u65f6<br \/>  3\uff0c&nbsp; &nbsp; &nbsp; &nbsp; Heroku\uff0c\u6700\u597d\u9700\u8981\u6ce8\u518c2\u4e2a\u5e10\u53f7\uff0c\u6ce8\u518c\u4e0e\u767b\u5f55\u65f6\u9700\u8981\u9b54\u6cd5\uff0c\u5e73\u65f6\u64cd\u4f5c\u65f6\u4e0d\u9700\u8981<br \/>  OneManager\u914d\u7f6e\u662f\u4fdd\u5b58\u5728\u73af\u5883\u53d8\u91cf\u4e2d\u7684\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u4e00\u76f4\u76d1\u63a7\u4fdd\u6d3b\uff0cHeroku\u514d\u8d39\u5957\u9910\u6bcf\u6708550\u5c0f\u65f6\uff0c550\u5c0f\u65f6\/30\u5929=18.33\u5c0f\u65f6\uff0c\u6bcf\u5929\u53ea\u8981\u8bbf\u95ee\u65f6\u95f4\u6bb5\u7a7a\u51fa\u676524-18=6\u5c0f\u65f6\u6ca1\u6709\u4eba\u8bbf\u95ee\uff0c\u8fd9\u4e00\u4e2a\u6708\u5176\u5b9e\u5c31\u8db3\u591f\u4f7f\u7528\u4e86\uff0c\u4f46\u6709\u4e9b\u4eba\u7684\u7f51\u7ad9\u53ef\u80fd\u8bbf\u95ee\u4eba\u6bd4\u8f83\u591a\u6240\u4ee5\u8fd8\u6ca1\u5230\u6708\u5e95\u5c31\u7528\u5149\u4e86\u3002<br \/>  \u5f53\u7136\uff0cheroku\u4e5f\u53ef\u7ed1\u5361\u8fbe\u52301000\u5c0f\u65f6\uff0c\u540c\u65f6\u8fd8\u80fd\u81ea\u5b9a\u4e49\u57df\u540d\u3002\u4f46\uff0cSSL\u5374\u6bd4\u8f83\u9ebb\u70e6\u3002<br \/>  4\uff0c&nbsp; &nbsp; &nbsp; &nbsp; CF workers\uff0c\u514d\u8d39\u7684\u5c31\u597d<\/p>\n<p>  \u90e8\u7f72\u7a0b\u5e8f\u3001\u5b89\u88c5\u7a0b\u5e8f\u3001\u7ed1\u5b9a\u7f51\u76d8\uff1a<br \/>  1\uff0c&nbsp; &nbsp; &nbsp; &nbsp; \u5c06OneManager\u4e00\u952e\u90e8\u7f72\u5230Heroku<br \/>  2\uff0c&nbsp; &nbsp; &nbsp; &nbsp; \u8bbf\u95ee\u7ed9\u5b9a\u7684herokuapp\u57df\u540d\uff0c\u6b63\u5f0f\u5b89\u88c5\u597d\u7a0b\u5e8f<br \/>  3\uff0c&nbsp; &nbsp; &nbsp; &nbsp; \u5b89\u88c5\u597d\u540e\u767b\u5f55\uff0c\u5728\u8bbe\u7f6e\u4e2d\u7ed1\u5b9aOnedrive\u6216Sharepoint<br \/>  4\uff0c&nbsp; &nbsp; &nbsp; &nbsp; \u5728\u8bbe\u7f6e\u4e2d\u505a\u4e9b\u8bbe\u5b9a<br \/>  5\uff0c&nbsp; &nbsp; &nbsp; &nbsp; \u6362\u4e00\u4e2aHeroku\u5e10\u53f7\u518d\u5b89\u88c5\u4e00\u6b21\uff08\u65f6\u957f\u591f\u7528\u5c31\u65e0\u6240\u8c13\uff09<\/p>\n<p>  \u91cd\u70b9\uff1a<br \/>  \u5728CF Workers\u4e2d\u586b\u5165\u4ee5\u4e0b\u4ee3\u7801<\/p>\n<p>  \/\/ \u5355\u65e5<br \/>  const SingleDay = &#8216;111.herokuapp.com&#8217;<br \/>  \/\/ \u53cc\u65e5<br \/>  const DoubleDay = &#8216;222.herokuapp.com&#8217;<br \/>  \/\/ \u4e00\u5207\u7ed9CF\u4ee3\u7406\uff0ctrue\/false<br \/>  const CFproxy = true<\/p>\n<p>  \/\/ \u7531\u4e8eheroku\u4e0d\u7ed1\u5361\u4e0d\u80fd\u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u5c31\u7b97\u7ed1\u5361\u540ehttps\u4e5f\u4e0d\u65b9\u4fbf<br \/>  \/\/ \u53e6\u5916\u514d\u8d39\u5957\u9910\u6bcf\u6708550\u5c0f\u65f6\uff0c\u6709\u4e9b\u4eba\u4e0d\u591f\u7528<br \/>  \/\/ \u4e8e\u662f\u5728CF Workers\u4f7f\u7528\u6b64\u4ee3\u7801\uff0c\u5206\u5355\u53cc\u65e5\u62c9\u53d6\u4e0d\u540cheroku\u5e10\u53f7\u4e0b\u7684\u76f8\u540c\u7f51\u9875<br \/>  \/\/ \u53ea\u6539\u4e0a\u9762\uff0c\u4e0b\u9762\u4e0d\u7528\u52a8<\/p>\n<p>  addEventListener(&#8216;fetch&#8217;, event =&gt; {<br \/>  &nbsp; &nbsp; let nd = new Date();<br \/>  &nbsp; &nbsp; if (nd.getDate()%2) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;host = SingleDay<br \/>  &nbsp; &nbsp; } else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;host = DoubleDay<br \/>  &nbsp; &nbsp; }<br \/>  &nbsp; &nbsp; if (!CFproxy) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;let url=new URL(event.request.url);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;if (url.protocol == &#8216;http:&#8217;) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;url.protocol = &#8216;https:&#8217;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;response = Response.redirect(url.href);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;event.respondWith( response );<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;} else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;url.hostname=host;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;let request=new Request(url,event.request);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;event.respondWith( fetch(request) )<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<br \/>  &nbsp; &nbsp; } else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;event.respondWith( fetchAndApply(event.request) );<br \/>  &nbsp; &nbsp; }<br \/>  })<\/p>\n<p>  async function fetchAndApply(request) {<br \/>  &nbsp; &nbsp; let response = null;<br \/>  &nbsp; &nbsp; let url = new URL(request.url);<br \/>  &nbsp; &nbsp; if (url.protocol == &#8216;http:&#8217;) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;url.protocol = &#8216;https:&#8217;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;response = Response.redirect(url.href);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return response;<br \/>  &nbsp; &nbsp; }<br \/>  &nbsp; &nbsp; url.host = host;<\/p>\n<p>  &nbsp; &nbsp; let method = request.method;<br \/>  &nbsp; &nbsp; let body = request.body;<br \/>  &nbsp; &nbsp; let request_headers = request.headers;<br \/>  &nbsp; &nbsp; let new_request_headers = new Headers(request_headers);<\/p>\n<p>  &nbsp; &nbsp; new_request_headers.set(&#8216;Host&#8217;, url.host);<br \/>  &nbsp; &nbsp; new_request_headers.set(&#8216;Referer&#8217;, request.url);<\/p>\n<p>  &nbsp; &nbsp; let original_response = await fetch(url.href, {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;method: method,<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;body: body,<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;headers: new_request_headers<br \/>  &nbsp; &nbsp; });<\/p>\n<p>  &nbsp; &nbsp; response = new Response(original_response.body, {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;status: original_response.status,<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;headers: original_response.headers<br \/>  &nbsp; &nbsp; })<\/p>\n<p>  &nbsp; &nbsp; return response;<br \/>  }<\/p>\n<p>  \u5355\u53cc\u65e5\u5206\u522b\u586b\u5165\u4e0d\u540c\u7684heroku\u5e10\u53f7\u4e0b\u7684\u7f51\u7ad9\uff08\u5f53\u71362\u4e2a\u7f51\u7ad9\u8981\u8bbe\u7f6e\u5f97\u4e00\u6a21\u4e00\u6837\uff09\uff0c\u8fd9\u6837\u6bcf\u4e2aheroku\u5e10\u53f7\u6bcf\u4e2a\u6708\u90fd\u53ea\u8bbf\u95ee15\u621616\u5929\uff0c\u5c31\u7b9724\u5c0f\u65f6\u6709\u4eba\u8bbf\u95ee\u4e5f\u624d360\u6216384\u5c0f\u65f6\u3002<br \/>  \u6700\u540e\uff0c\u7ed9workers\u52a0\u4e0a\u81ea\u5b9a\u4e49\u57df\u540d\u7684\u8def\u7531\uff01<\/p>\n<p>  \u4ece\u5934\u5230\u5c3e\u90fd\u53ef\u4ee5\u662fFree\u7684\uff0c\u4e0d\u770b\u7f51\u7ad9\u9875\u9762\uff0c\u5149\u4ece\u4e0b\u8f7d\u8fc7\u7a0b\u6765\u770b\uff0c\u53ef\u4ee5\u5b8c\u5168\u5047\u88c5CF\u5957\u5728\u4e86\u5927\u76d8\u9e21\u4e0a,\u8c01\u4e5f\u770b\u4e0d\u51fa\u6211\u6ca1\u670d\u52a1\u5668\u3002  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>googlebot2<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6218\u7565mark\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>yueyyy<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u611f\u8c22\u5927\u4f6c\u5206\u4eabhttps:\/\/cdn.jsdelivr.net\/gh\/hishis\/forum-master\/public\/images\/patch.gif\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>llmwxt<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5389\u5bb3\u4e86\uff0c\u4f46\u662f\u6211\u8fd8\u662f\u6ca1\u770b\u660e\u767d\uff01:hug::hug::hug:\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>leecash<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u6837\u7684\u8bdd\u4e0b\u8f7d\u4e0a\u4f20\u8d70\u8c01\u7684\u6d41\u91cf\uff1fcd worker\u8fd8\u662fheroku\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>cxuqry<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5389\u5bb3\u4e86\u5927\u4f6c\uff0c\u770b\u5f97\u4e0d\u662f\u5f88\u61c2\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u9038\u7b19<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tleecash \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-8-29 23:27<br \/>  \u8fd9\u6837\u7684\u8bdd\u4e0b\u8f7d\u4e0a\u4f20\u8d70\u8c01\u7684\u6d41\u91cf\uff1fcd worker\u8fd8\u662fheroku<\/p>\n<p> \u4e0b\u8f7d\u8d70\u7684CF Workers\u7684\uff0c<br \/>  \u4e0a\u4f20\u8fd8\u662f\u4f60\u5bf9\u5fae\u8f6f\u76f4\u63a5\u4e0a\u4f20\uff0c\u4e0d\u8d70\u8c01\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>_____________Cc<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6536\u85cf12\u56de\u5e167\u597d\u591aMJJ\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>langvs<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u60ca\u73b0\u8611\u83c7\u5927\u4f6c~\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>seaprince<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5927\u4f6c\u80fd\u4e0d\u80fd\u8ba9od\u76f4\u94fe\u7684 \u8d70cf\u6d41\u91cf\u7684\u8bdd\u4e16\u7eaa\u4e92\u8054\u901f\u5ea6\u4e0a\u4e0d\u6765\u5427\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9038\u7b19 \u5927\u4f6c\u6709\u8bdd\u8bf4 : Onedri&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/148002"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=148002"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/148002\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148002"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}