kuroshiro icon indicating copy to clipboard operation
kuroshiro copied to clipboard

Error when setting dictPath to an https url

Open akukerang opened this issue 2 years ago • 6 comments

When using it an Chrome content script, setting the Kuromoji analyzer dict path to an https server, would just send a GET request to "https://currentsite.com/https://dhasdjashdkajdha.com/...". I would like it just for it to be "https://dhasdjashdkajdha.com/....". Using an http URL works fine, but Chrome would return the error "Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint '<URL>'. This request has been blocked; the content must be served over HTTPS." Is there a way that I can set the dictPath to an https url?

import Kuroshiro from "kuroshiro";
// Initialize kuroshiro with an instance of analyzer (You could check the [apidoc](#initanalyzer) for more information):
// For this example, you should npm install and import the kuromoji analyzer first
import KuromojiAnalyzer from "kuroshiro-analyzer-kuromoji"
// Instantiate
const kuroshiro = new Kuroshiro();
// Initialize
// Here uses async/await, you could also use Promise
await kuroshiro.init(new KuromojiAnalyzer({
    dictPath: "https://dhasdjashdkajdha.com/"
}));
// Convert what you want
const result = await kuroshiro.convert("感じ取れたら手を繋ごう、重なるのは人生のライン and レミリア最高!", { to: "hiragana" });
console.log(result);

akukerang avatar Apr 24 '22 20:04 akukerang

have u solved it? @akukerang

chinenvinicius avatar Aug 06 '22 03:08 chinenvinicius

@chinenvinicius no

akukerang avatar Aug 06 '22 04:08 akukerang

seems like it calls dictpath on the index page but when i go to other pages. this dictfile deosnt load at all. only working on one page.

let kuroshiro = new Kuroshiro(); await kuroshiro.init(new KuromojiAnalyzer()); . this is the code . do u have the same issue? スクリーンショット (38)

chinenvinicius avatar Aug 06 '22 04:08 chinenvinicius

I kind of gave up trying to figure it out and I can't really remember what the error was exactly. Sorry about that.

akukerang avatar Aug 06 '22 04:08 akukerang

seems like it calls dictpath on the index page but when i go to other pages. this dictfile deosnt load at all. only working on one page.

let kuroshiro = new Kuroshiro(); await kuroshiro.init(new KuromojiAnalyzer()); . this is the code . do u have the same issue? スクリーンショット (38)

did you solve this?

jgaynor17 avatar Apr 02 '23 16:04 jgaynor17

@jgaynor17 i couldnt solve it. but these have to do with core code. u need to use an old version of kuroshiro which work but it slow to donwload on the client . in my case it takes more than 30 seconds to dowload the whole library if speed is issue i would recommmend to implement it on the server side not client side. this issues is problay have to do on hotw dictionary is being passed on the code., kuroshiro.

chinenvinicius avatar Apr 03 '23 07:04 chinenvinicius