From e3a4a723dbe6e8253dee5f75a53edcb8f59dc402 Mon Sep 17 00:00:00 2001 From: extracold1209 Date: Wed, 22 Aug 2018 15:24:52 +0900 Subject: [PATCH] [1.6.11] jquery get method override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - API 블럭은 서버에 데이터를 요청해야 하는 경우가 있는데, /로 시작하는 경우 일렉트론에서 파일경로로 인식하므로 이때 url 로 치환 --- src/entry_offline.js | 2 ++ src/renderer/src/require.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/entry_offline.js b/src/entry_offline.js index bc2b8a0fd..6bbaf58e7 100644 --- a/src/entry_offline.js +++ b/src/entry_offline.js @@ -43,6 +43,8 @@ global.sharedObject = { workingPath: '', isInitEntry: false, appName: 'entry', + hostURI: hostURI, + hostProtocol: hostProtocol }; function logger(text) { diff --git a/src/renderer/src/require.js b/src/renderer/src/require.js index e543c0077..c1703c533 100644 --- a/src/renderer/src/require.js +++ b/src/renderer/src/require.js @@ -40,6 +40,24 @@ const filbert = parser; import util from './src/sources/util'; const Util = util; +$.get = function(url, data, callback, type){ + if ( $.isFunction(data) ){ + type = type || callback, + callback = data, + data = {} + } + if(/^\//.test(url)) { + url = `${sharedObject.hostProtocol}//${sharedObject.hostURI}${url}`; + } + return $.ajax({ + url: url, + type: 'GET', + success: callback, + data: data, + contentType: type + }); +}; + document.fonts.ready.then(() => { try { if (Entry) {