Skip to content

Commit

Permalink
Merge pull request #203 from RubberRobot/AutomaticHomebrewLoad
Browse files Browse the repository at this point in the history
Added the ability to server and import homebrew on first page load.
  • Loading branch information
datdamnzotz authored Jul 13, 2019
2 parents 43f3c69 + 99c461b commit 234dfcd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ env.sh
/data
*.crt
*.key
deploy/homebrew/*
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Windows instructions [here](https://github.com/Orcpub/orcpub/wiki/Orcpub-on-Wind

Docker Cheat [Sheet](https://github.com/Orcpub/orcpub/wiki/Docker-Cheat-sheet)

### Importing your homebrew automatically

To have your homebrew orcbrew file automatically loaded when a new client connects place it in the 'deploy/homebrew/' folder with the name "homebrew.orcbrew".
All orcbrew files have to be combined into a single file named "homebrew.orcbrew" because that is the only file that will be loaded.
This will elect to not import the homebrew if any other homebrew has already been imported on that device.
If you want to overwrite what is already loaded delete all of the content from the Content List section and reload the page.

## Getting Started with Development

### With docker
Expand Down
4 changes: 4 additions & 0 deletions deploy/homebrew/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To have your homebrew orcbrew file automatically loaded when a new client connects place it here with the name "homebrew.orcbrew".
All orcbrew files have to be combined into a single file named "homebrew.orcbrew" because that is the only file that will be loaded.
This will elect to not import the homebrew if any other homebrew has already been imported on that device.
If you want to overwrite what is already loaded delete all of the content from the Content List section and reload the page.
3 changes: 3 additions & 0 deletions deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ server {
location = /50x.html {
root /usr/share/nginx/html;
}
location /homebrew.orcbrew {
root /usr/share/nginx/html/homebrew;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- ./deploy/nginx.conf:/etc/nginx/conf.d/default.conf
- ./deploy/snakeoil.crt:/etc/nginx/snakeoil.crt
- ./deploy/snakeoil.key:/etc/nginx/snakeoil.key
- ./deploy/homebrew/:/usr/share/nginx/html/homebrew/
depends_on:
- orcpub
restart: always
15 changes: 14 additions & 1 deletion src/clj/orcpub/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,17 @@ html, body, #app {
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-69209720-3', 'auto');
ga('send', 'pageview');"]]))
ga('send', 'pageview');
let plugins = localStorage.getItem('plugins');
if(plugins === null || plugins === '{}')
{
fetch('https://' + window.location.host + '/homebrew.orcbrew')
.then(resp => resp.text())
.then(text => {
if(!text.toUpperCase().includes('NOT FOUND')){
localStorage.setItem('plugins',text);
window.location.reload(false);
}
});
}
"]]))

0 comments on commit 234dfcd

Please sign in to comment.