Skip to content

Commit

Permalink
Merge pull request #12 from redribbon0403/dev
Browse files Browse the repository at this point in the history
Fix https issue
  • Loading branch information
redribbon0403 authored Dec 8, 2022
2 parents ca4a9f8 + afba7e2 commit 6789fd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/service/core/scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ export default class Scraper {
let voiceUrl = []
let jumpUrl = ""

const regexp = new RegExp('^(?:http|https)://resource.mobamas.net');
for (let i of extraUrl){
if (i.startsWith("http://resource.mobamas.net")) {
if (regexp.test(i)) {
voiceUrl.push(i)
} else {
jumpUrl = i
Expand Down
7 changes: 5 additions & 2 deletions src/service/utils/swf-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getUrlFromSwf(data) {
let pos = 0

while(true){
let start = data.indexOf(Buffer.from("http://"), pos)
let start = data.indexOf(Buffer.from("http"), pos)
let end = data.indexOf(Buffer.from(["0x00"]), start)

if (start == -1 || end == -1){
Expand All @@ -18,7 +18,10 @@ function getUrlFromSwf(data) {

let str = data.subarray(start, end).toString("utf8")

if(str.startsWith("http://sp.pf.mbga.jp") || str.startsWith("http://resource.mobamas.net")){
const regexp1 = new RegExp('^(?:http|https)://resource.mobamas.net');
const regexp2 = new RegExp('^(?:http|https)://sp.pf.mbga.jp');

if(regexp1.test(str) || regexp2.test(str)){
result.push(str)
}

Expand Down
1 change: 1 addition & 0 deletions src/service/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function replaceTextByDict({page, data, fromKey="from", toKey="to"}){
function convertJumpUrl(jump_url) {
let newJumpUrl = decodeURIComponent(jump_url)
newJumpUrl = newJumpUrl.replaceAll("http://sp.pf.mbga.jp/12008305/?guid=ON&url=http://mobamas.net", "")
newJumpUrl = newJumpUrl.replaceAll("https://sp.pf.mbga.jp/12008305/?guid=ON&url=http://mobamas.net", "")
newJumpUrl = newJumpUrl.split("/").slice(0, -1).join("/")

return newJumpUrl
Expand Down

0 comments on commit 6789fd2

Please sign in to comment.