-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChromiumVersion 1.0.2 Rename and Bug Fixes
- Loading branch information
Showing
22 changed files
with
1,081 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"extensionDescription": { | ||
"message": "With Genshin/Star Rail CodeEntter you can quickly enter promo codes for Genshin Impact and Honkai Star Rail, and you can also share a link to this code :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" | ||
}, | ||
"submit": { | ||
"message": "Enter" | ||
}, | ||
"share": { | ||
"message": "Share" | ||
}, | ||
"labelgi": { | ||
"message": "Genshin Impact Only:" | ||
}, | ||
"labelHsr": { | ||
"message": "Honkai Star Rail Only:" | ||
}, | ||
"options": { | ||
"message": "Settings" | ||
}, | ||
"submitGI": { | ||
"message": "Genshin" | ||
}, | ||
"submitHSR": { | ||
"message": "Star Rail" | ||
}, | ||
"shareGI": { | ||
"message": "Share GI" | ||
}, | ||
"shareHSR": { | ||
"message": "Share HSR" | ||
}, | ||
"reset": { | ||
"message": "Reset" | ||
}, | ||
"buttonColort": { | ||
"message": "Button color:" | ||
}, | ||
"buttonTextColort": { | ||
"message": "Text color:" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"extensionDescription": { | ||
"message": "Con Genshin/Star Rail CodeEntter puedes ingresar rápidamente códigos promocionales para Genshin Impact y Honkai Star Rail, y también puedes compartir un enlace a este código :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" | ||
}, | ||
"submit": { | ||
"message": "Ingresar" | ||
}, | ||
"share": { | ||
"message": "Compartir" | ||
}, | ||
"labelgi": { | ||
"message": "Solo Genshin Impact:" | ||
}, | ||
"labelHsr": { | ||
"message": "Solo Honkai Star Rail:" | ||
}, | ||
"options": { | ||
"message": "Configuraciones" | ||
}, | ||
"submitGI": { | ||
"message": "Genshin" | ||
}, | ||
"submitHSR": { | ||
"message": "Star Rail" | ||
}, | ||
"shareGI": { | ||
"message": "Compartir GI" | ||
}, | ||
"shareHSR": { | ||
"message": "Compartir HSR" | ||
}, | ||
"reset": { | ||
"message": "Restablecer" | ||
}, | ||
"buttonColort": { | ||
"message": "Color del botón:" | ||
}, | ||
"buttonTextColort": { | ||
"message": "Color del texto:" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"extensionDescription": { | ||
"message": "Genshin/Star Rail CodeEntterを使用すると、Genshin ImpactとHonkai Star Railのプロモーションコードをすばやく入力でき、このコードへのリンクを共有することもできます:) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" | ||
}, | ||
"submit": { | ||
"message": "入力" | ||
}, | ||
"share": { | ||
"message": "共有" | ||
}, | ||
"labelgi": { | ||
"message": "Genshin Impactのみ:" | ||
}, | ||
"labelHsr": { | ||
"message": "Honkai Star Railのみ:" | ||
}, | ||
"options": { | ||
"message": "設定" | ||
}, | ||
"submitGI": { | ||
"message": "Genshin" | ||
}, | ||
"submitHSR": { | ||
"message": "Star Rail" | ||
}, | ||
"shareGI": { | ||
"message": "GIを共有" | ||
}, | ||
"shareHSR": { | ||
"message": "HSRを共有" | ||
}, | ||
"reset": { | ||
"message": "リセット" | ||
}, | ||
"buttonColort": { | ||
"message": "ボタンの色:" | ||
}, | ||
"buttonTextColort": { | ||
"message": "テキストの色:" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"extensionDescription": { | ||
"message": "Благодаря Genshin/Star Rail CodeEntter вы сможете быстро вводить промокоды для Genshin Impact и Honkai Star Rail, a также можете поделиться ссылкой на этот кодик :) ChromiumVersion 1.0.2 https://github.com/Kajitsy/Genshin-Star-Rail-CodeEntter" | ||
}, | ||
"submit": { | ||
"message": "Ввести" | ||
}, | ||
"share": { | ||
"message": "Поделиться" | ||
}, | ||
"labelgi": { | ||
"message": "Только Genshin Impact:" | ||
}, | ||
"labelHsr": { | ||
"message": "Только Honkai Star Rail:" | ||
}, | ||
"options": { | ||
"message": "Настройки" | ||
}, | ||
"submitGI": { | ||
"message": "Genshin" | ||
}, | ||
"submitHSR": { | ||
"message": "Star Rail" | ||
}, | ||
"shareGI": { | ||
"message": "Поделиться GI" | ||
}, | ||
"shareHSR": { | ||
"message": "Поделиться HSR" | ||
}, | ||
"reset": { | ||
"message": "Сбросить" | ||
}, | ||
"buttonColort": { | ||
"message": "Цвет кнопок:" | ||
}, | ||
"buttonTextColort": { | ||
"message": "Цвет текста:" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
if (typeof browser === "undefined") { | ||
browser = chrome; | ||
} | ||
|
||
const GIHOSTS = [ | ||
{ | ||
apiHost: "sg-hk4e-api.hoyolab.com", | ||
page: "act.hoyolab.com/ys/event/signin-sea-v3/index.html" | ||
}, | ||
{ | ||
apiHost: "hk4e-api-os.mihoyo.com", | ||
page: "webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html" | ||
} | ||
]; | ||
|
||
var currentGIHosts = GIHOSTS; | ||
|
||
function getCurrDay() { | ||
var now = new Date(); | ||
now.setMinutes(now.getMinutes() + now.getTimezoneOffset()); | ||
now.setHours(now.getHours() + 8); | ||
return Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0); | ||
} | ||
|
||
function request(i, currDay) { | ||
var host = currentGIHosts[i]; | ||
if (typeof host === "undefined") { | ||
currentGIHosts = GIHOSTS; | ||
return; | ||
} | ||
fetch("https://" + host.apiHost + "/event/sol/sign?act_id=e202102251931481", { | ||
method : "POST", | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
credentials: "include" | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
if(data.retcode == 0 || data.retcode == -5003) { | ||
browser.storage.local.set({gi_lastCheked: currDay}); | ||
currentGIHosts = [host]; | ||
} else { | ||
console.log("badrequest", data); | ||
request(i + 1); | ||
} | ||
}) | ||
.catch(error => { | ||
console.log("error", error); | ||
request(i + 1); | ||
}); | ||
} | ||
|
||
function check() { | ||
browser.storage.local.get({gi_lastCheked: null}).then(storage => { | ||
var currDay = getCurrDay(); | ||
if (storage.gi_lastCheked != currDay) { | ||
request(0, currDay); | ||
} | ||
}); | ||
} | ||
|
||
browser.alarms.onAlarm.addListener(alarm => { | ||
if (alarm.name == "gi_checker") { | ||
check(); | ||
} | ||
}); | ||
|
||
browser.alarms.create("gi_checker", {when: Date.now(), periodInMinutes: 1}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
if (typeof browser === "undefined") { | ||
browser = chrome; | ||
} | ||
|
||
const HSRHOSTS = [ | ||
{ | ||
apiHost: "sg-public-api.hoyolab.com", | ||
page: "act.hoyolab.com/bbs/event/signin/hkrpg/index.html" | ||
} | ||
]; | ||
var currentHSRHosts = HSRHOSTS; | ||
|
||
function getCurrDay() { | ||
var now = new Date(); | ||
now.setMinutes(now.getMinutes() + now.getTimezoneOffset()); | ||
now.setHours(now.getHours() + 8); | ||
return Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0); | ||
} | ||
|
||
function request(i, currDay) { | ||
var host = currentHSRHosts[i]; | ||
if (typeof host === "undefined") { | ||
currentHSRHosts = HSRHOSTS; | ||
return; | ||
} | ||
fetch("https://" + host.apiHost + "/event/luna/os/sign", { | ||
method : "POST", | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
credentials: "include", | ||
body: JSON.stringify({ | ||
"act_id": "e202303301540311" | ||
}) | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
if(data.retcode == 0 || data.retcode == -5003) { | ||
browser.storage.local.set({hsr_lastCheked: currDay}); | ||
currentHSRHosts = [host]; | ||
} else { | ||
console.log("badrequest", data); | ||
request(i + 1); | ||
} | ||
}) | ||
.catch(error => { | ||
console.log("error", error); | ||
request(i + 1); | ||
}); | ||
} | ||
|
||
function check() { | ||
browser.storage.local.get({hsr_lastCheked: null}).then(storage => { | ||
var currDay = getCurrDay(); | ||
if (storage.hsr_lastCheked != currDay) { | ||
request(0, currDay); | ||
} | ||
}); | ||
} | ||
|
||
browser.alarms.onAlarm.addListener(alarm => { | ||
if (alarm.name == "hsr_checker") { | ||
check(); | ||
} | ||
}); | ||
|
||
browser.alarms.create("hsr_checker", {when: Date.now(), periodInMinutes: 1}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Genshin/Star Rail CodeEntter", | ||
"version": "1.0.2", | ||
"description": "__MSG_extensionDescription__", | ||
"default_locale": "en", | ||
"icons": { | ||
"512": "/pictures/icon.png" | ||
}, | ||
"permissions": [ | ||
"activeTab", | ||
"cookies", | ||
"storage", | ||
"alarms" | ||
], | ||
"host_permissions": [ | ||
"*://*.hoyoverse.com/", | ||
"*://*.mihoyo.com/*", | ||
"*://*.hoyolab.com/*" | ||
], | ||
"action": { | ||
"default_icon": "/pictures/icon.png", | ||
"default_title": "CodeEntter" | ||
}, | ||
"options_ui": { | ||
"page": "options.html", | ||
"open_in_tab": false | ||
}, | ||
"background": { | ||
"service_worker": "script_imports.js" | ||
} | ||
} |
Oops, something went wrong.