DOMAIN env var functionality improvements

This commit is contained in:
mrfry 2023-04-11 11:18:13 +02:00
parent d9e5c8bdb0
commit 8e91b93d29
3 changed files with 2 additions and 94 deletions

View file

@ -1,51 +0,0 @@
# Setup
A `stable.user.js`-ben a következő sorokat módosítsd a helyi szerver használatához:
## 0
Tampermonkey-ban tiltsd le az eddig használt scriptet, hogy ne akadjanak össze
## 1
**Ezt csak akkor csináld, ha a scripthez tartozó szervert futtatod!** Ha nem indítasz hozzá
szervert, akkor az alapértelmezettet fogja használni.
Scripthez szerver: https://gitlab.com/MrFry/mrfrys-node-server/-/tree/master/devel
```javascript
setVal('ISDEVEL', false)
// only one of these should be true for testing
const forceTestPage = false
const forceResultPage = false
const forceDefaultPage = false
```
Itt a `setVal('ISDEVEL', false)`-t írd át `setVal('ISDEVEL, true)`-ra
## 2
Nyisd meg a tampermonkey bővítményt, majd hozz létre egy új scriptet
A megnyíló ablakban tölrölj mindent a szerkesztőben, és a `devel/testWrapper.js` fájl tartalmát
másold be úgy ahogy van.
## 3
A bemásolt tartalomban keresd meg a következő részt:
```
// @require file:///{ELÉRÉSI ÚT IDE}
```
Ide írd be a `stable.user.js` elérési útvonalát. Ezt legkönyebben úgy teheted meg, hogy fájl
böngészőből behúzod az URL bárba a `stable.user.js`-t magát. Ekkor felugorhat a tampermonkey hogy
telepíteni akarja, de azt zárd be és egy üres ablakban ott kellene lennie az URL bárban a teljes
elérési útnak. Ezt úgy hogy a `file:///` legyen az eleje másold be a a `@require` tag-hez
## 4
Ha minden jól ment, akkor a moddle oldalán már a helyi változatnak kellene futnia, és minden
`stable.user.js` módosítás azonnal látható a böngésző frissítése után. Minden változás után
frissítsd az oldalt, hogy lásd a módosításaid!
Weboldalak, ahol fut a script: a script headerben található (`stable.user.js` elején) találhatóak
`// @match` tagek. Azok közül minden oldalon megy a script.

View file

@ -1,41 +0,0 @@
/* ----------------------------------------------------------------------------
Online Moodle/Elearning/KMOOC test help
https://greasyfork.org/en/scripts/38999-moodle-elearning-kmooc-test-help
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------- */
// ==UserScript==
// @name Moodle/Elearning/KMOOC test help
// @version DEVEL
// @description Online Moodle/Elearning/KMOOC test help
// @author You
// @match https://elearning.uni-obuda.hu/*
// @match https://qmining.frylabs.net/*
// @match file:///*
// @grant GM_getResourceText
// @grant GM_info
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// @grant GM_openInTab
// @require file:///{ELÉRÉSI ÚT IDE}
// ==/UserScript==
;(function () {
console.log('done')
})()

View file

@ -6,12 +6,12 @@ resultUserscriptPath="./stable.user.js"
domain="${DOMAIN}"
if [ -f "${domainPath}" ]; then
if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then
domain=$(cat "${domainPath}")
fi
if [ -z "${domain}" ]; then
echo -e "\033[0;41m${domainPath} does not exist, and DOMAIN is not set!\033[0m"
echo -e "\033[0;41mDOMAIN is not set, and ${domainPath} does not exist!\033[0m"
exit 1
fi