Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from dpeGit/main
Browse files Browse the repository at this point in the history
change to beta loader to always use the latest branch
  • Loading branch information
dpeGit authored Apr 16, 2023
2 parents 943df3b + 3586e1a commit b10d323
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GenLite 0.2.19-0 - For GenFanad
# GenLite 0.2.19-1 - For GenFanad

GenLite installation instructions
1. Install [TamperMonkey(All Browsers)](https://www.tampermonkey.net/) in your browser of choice.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genlite",
"version": "0.2.19-0",
"version": "0.2.19-1",
"scripts": {
"build:prodbeta": "npm version prerelease --no-git-tag-version --force && npx webpack --mode production --env type=prerelease",
"build:prodrelease": "npm version patch --no-git-tag-version --force && npx webpack --mode production --env type=release",
Expand Down
23 changes: 20 additions & 3 deletions src/Loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License along with Foobar. If not, see <https://www.gnu.org/licenses/>.
*/

let githubConfig = require('./githubConfig')
let githubConfig = require('./githubConfig');

// Check the Local Storage for GenLite.UpdateTimestamp
let genliteUpdateTimestamp = localStorage.getItem('GenLite.UpdateTimestamp');
Expand Down Expand Up @@ -55,8 +55,25 @@ if (genfanadModifiedDate == null || genfanadModifiedDate == undefined) {
genfanadLastModified = new Date(genfanadModifiedDate);
}

/* grab the urls needed for the loader. githubConfig is generated by the pipeline. */
let releasesUrl;
let distUrl;
if (githubConfig.type == "release") {
releasesUrl = `https://api.github.com/repos/${githubConfig.repoOwner}/GenLite/releases/latest`
distUrl = `https://raw.githubusercontent.com/${githubConfig.repoOwner}/GenLite/release/dist/genliteClient.user.js`
} else {
/* for pre release grab the lastest version either release or prerelease */
let release = new XMLHttpRequest();
release.open('GET', `https://api.github.com/repos/${githubConfig.repoOwner}/GenLite/releases`, false);
release.setRequestHeader("Accept", "application/vnd.github.v3+json")
release.send();
let releasesArray = eval(release.responseText);
releasesUrl = releasesArray[0].url
distUrl = `https://raw.githubusercontent.com/${githubConfig.repoOwner}/GenLite/beta/dist/genliteClient.user.js`
}

let xhrGenliteModified = new XMLHttpRequest();
xhrGenliteModified.open('GET', githubConfig.releasesUrl, false);
xhrGenliteModified.open('GET', releasesUrl, false);
xhrGenliteModified.setRequestHeader("Accept", "application/vnd.github.v3+json")
xhrGenliteModified.send();
let genliteAPIRespose = JSON.parse(xhrGenliteModified.responseText);
Expand Down Expand Up @@ -251,7 +268,7 @@ if (needsUpdate) {
okayButton.onclick = (e) => {
localStorage.setItem('GenLite.UpdateTimestamp', genliteLastModified.toString());
let xhrGenLiteJS = new XMLHttpRequest();
xhrGenLiteJS.open("GET", githubConfig.distUrl);
xhrGenLiteJS.open("GET", distUrl);
xhrGenLiteJS.onload = function () {
if (xhrGenLiteJS.status == 200) {
let genliteJS = xhrGenLiteJS.responseText;
Expand Down
15 changes: 2 additions & 13 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,8 @@ module.exports = (env, argv) => {
repoOwner = process.env.repoOwner;
}
let githubConfig = {};
if (env.type == "release") {
githubConfig.releasesUrl = `https://api.github.com/repos/${repoOwner}/GenLite/releases/latest`
githubConfig.distUrl = `https://raw.githubusercontent.com/${repoOwner}/GenLite/release/dist/genliteClient.user.js`
} else {
let release = new XMLHttpRequest.XMLHttpRequest();
release.open('GET', `https://api.github.com/repos/${repoOwner}/GenLite/releases`, false);
release.setRequestHeader("Accept", "application/vnd.github.v3+json")
release.send();
let releasesArray = eval(release.responseText);
githubConfig.releasesUrl = releasesArray[0].url
githubConfig.distUrl = `https://raw.githubusercontent.com/${repoOwner}/GenLite/beta/dist/genliteClient.user.js`

}
githubConfig.type = env.type;
githubConfig.repoOwner = repoOwner;
fs.writeFileSync('./src/Loader/githubConfig.json', JSON.stringify(githubConfig));
modules.push(
{
Expand Down

0 comments on commit b10d323

Please sign in to comment.