Skip to content

Commit

Permalink
UI major update
Browse files Browse the repository at this point in the history
image chnage and some fixes
new Image LSIO Nginx
php7 support
log support
more performance
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Nov 8, 2019
1 parent a2e9e85 commit 15d6162
Show file tree
Hide file tree
Showing 19 changed files with 1,109 additions and 82 deletions.
10 changes: 3 additions & 7 deletions menu/pgui/templates/_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

- name: Set cname
set_fact:
cname: ",{{ucname.stdout}}.{{domain.stdout}}"
cname: "{{ucname.stdout}}.{{domain.stdout}}"
when: ucname_check.stat.exists == true and ucname.stdout != ""

- name: check if user port file exists
Expand All @@ -86,7 +86,7 @@
ignore_errors: True

- name: Storing Role Name
shell: "echo '{{pgrole}}' > /tmp/program_var"
shell: "echo '{{pgrole}}' >/tmp/program_var"
ignore_errors: True

# APPDATA
Expand Down Expand Up @@ -131,7 +131,7 @@

- name: 'If Fact Matches - Enable TLD'
set_fact:
tldset: ',{{domain.stdout}},www.{{domain.stdout}}'
tldset: '{{domain.stdout}}'
when: 'toplevel.stdout == pgrole'

- debug: msg="TLDSET is now for {{toplevel.stdout}}"
Expand Down Expand Up @@ -183,7 +183,3 @@
when: not oauth.stdout == 'good'

- debug: msg="OAuth - {{oauth.stdout}}"

##PG-Core

##PG-Core
3 changes: 1 addition & 2 deletions menu/pgui/templates/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mkdir -p /var/plexguide/checkers
rm -rf /var/plexguide/checkers/*.log
#mkdir -p /var/plexguide/checkers

###mergerfs part
mgversion="$(curl -s https://api.github.com/repos/trapexit/mergerfs/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/mgfs.log
touch /var/plexguide/checkers/mergerfs.log
Expand All @@ -27,7 +26,7 @@ elif [[ "$mgversion" != "$mgstored" ]]; then
else echo "stupid line"

fi
##### rclpone part

rcversion="$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/rclonestored.log
touch /var/plexguide/checkers/rclone.log
Expand Down
60 changes: 60 additions & 0 deletions menu/pgui/templates/commui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
#
# Title: Community UI
# moded from MrDoob for ptSCOMM
# GNU: General Public License v3.0
################################################################################
---
- hosts: localhost
gather_facts: false
tasks:
- name: 'Install File new UI'
template:
src: /opt/plexguide/menu/{{pgrole}}/templates/index.php
dest: /opt/appdata/{{pgrole}}/www/index.php
force: yes
owner: '1000'
group: '1000'

- name: Remove old files
file: 'path={{item}} state=absent mode=0775 owner=1000 group=1000'
with_items:
- '/opt/appdata/{{pgrole}}/www/index.html'

- name: 'Install File Check mergerfs / rClone'
template:
src: /opt/plexguide/menu/{{pgrole}}/templates/check.sh
dest: /opt/appdata/{{pgrole}}/check.sh
force: yes
owner: '1000'
group: '1000'

- name: 'Install File GTused'
template:
src: /opt/plexguide/menu/{{pgrole}}/templates/gtused.sh
dest: /opt/appdata/{{pgrole}}/gtused.sh
force: yes
owner: '1000'
group: '1000'

- name: 'Install File Mountcheck file'
copy:
src: /opt/plexguide/menu/{{pgrole}}/templates/mountcheck.sh
dest: /opt/plexguide/menu/{{pgrole}}/mountcheck.sh
force: yes

- name: 'Install File Check mergerfs / rClone'
template:
src: /opt/plexguide/menu/{{pgrole}}/templates/check.sh
dest: /opt/appdata/{{pgrole}}/check.sh
force: yes
owner: '1000'
group: '1000'

- name: 'Install File GTused'
template:
src: /opt/plexguide/menu/{{pgrole}}/templates/gtused.sh
dest: /opt/appdata/{{pgrole}}/gtused.sh
force: yes
owner: '1000'
group: '1000'
2 changes: 1 addition & 1 deletion menu/pgui/templates/gtused.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- cron:
name: Daily check for mgerfs / rclone new version
special_time: 'daily'
job: 'bash /opt/appdata/pgui/ckeck.sh'
job: 'bash /opt/appdata/pgui/check.sh'
state: present

- cron:
Expand Down
77 changes: 33 additions & 44 deletions menu/pgui/templates/index.php

Large diffs are not rendered by default.

189 changes: 189 additions & 0 deletions menu/pgui/templates/old/_core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Author(s): Admin9705
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
---
# RECALL KEY VARIABLES #########################################################

- name: 'Register TLD'
shell: 'cat /var/plexguide/tld.program'
register: toplevel
ignore_errors: True

- name: Register Domain
shell: 'cat /var/plexguide/server.domain'
register: domain
ignore_errors: True

- name: Register IP
shell: 'cat /var/plexguide/server.ip'
register: ipaddress
ignore_errors: True

- name: Register Ports
shell: 'cat /var/plexguide/server.ports'
register: ports
ignore_errors: True

- name: Register HD Path
shell: 'cat /var/plexguide/server.hd.path'
register: path
ignore_errors: True

- name: Register Auth Path
shell: 'cat /var/plexguide/server.ht'
register: auth
ignore_errors: True

- name: Register Program Name
shell: 'cat /tmp/program_var'
register: program
ignore_errors: True

- name: check if user cname file exists
stat:
path: /var/plexguide/{{pgrole}}.cname
register: ucname_check

- name: Register user cname
shell: 'cat /var/plexguide/{{pgrole}}.cname'
register: ucname
ignore_errors: True
when: ucname_check.stat.exists == true

- name: Register CName
set_fact:
cname: ""

- name: Set cname
set_fact:
cname: ",{{ucname.stdout}}.{{domain.stdout}}"
when: ucname_check.stat.exists == true and ucname.stdout != ""

- name: check if user port file exists
stat:
path: /var/plexguide/{{pgrole}}.port
register: ueport_check

- name: Register External Port
shell: 'cat /var/plexguide/{{pgrole}}.port'
register: ueport
ignore_errors: True
when: ueport_check.stat.exists == true

- name: Change extport
set_fact:
extport: "{{ueport.stdout}}"
when: ueport_check.stat.exists and ueport.stdout != ""

- name: Remove {{pgrole}} Container
docker_container:
name: '{{pgrole}}'
state: absent
ignore_errors: True

- name: Storing Role Name
shell: "echo '{{pgrole}}' > /tmp/program_var"
ignore_errors: True

# APPDATA
- name: 'Creating appdata folder if it does not exist.'
shell: 'mkdir -p /opt/appdata/{{pgrole}}'

- name: 'Setting ownership on appdata'
shell: 'chown 1000:1000 /opt/appdata/{{pgrole}}'
when: '"plex" in pgrole'

- name: 'Setting permissions on appdata'
shell: 'chmod 775 /opt/appdata/{{pgrole}}'
when: '"plex" in pgrole'

- name: 'Setting ownership on appdata recursivley (this can take a while!)'
shell: 'chown -R 1000:1000 /opt/appdata/{{pgrole}}'
when: '"plex" not in pgrole'

- name: 'Setting permissions on appdata recursivley (this can take a while!)'
shell: 'chmod -R 775 /opt/appdata/{{pgrole}}'
when: '"plex" not in pgrole'

# OVERWRITE IMAGES #############################################################
- name: Check if Image Variable Exists
stat:
path: '/var/plexguide/image/{{pgrole}}'
register: imagecheck

- name: 'Transfer Image Variable'
shell: 'cat /var/plexguide/image/{{pgrole}}'
register: imagetemp
when: imagecheck.stat.exists

- name: 'If Fact Does Not Match - Disable TLD'
set_fact:
image: '{{imagetemp.stdout}}'
when: imagecheck.stat.exists

# TOP LEVEL DOMAIN INFO SET ####################################################

- debug: msg="Stored TLD - {{pgrole}} must match {{toplevel.stdout}} for TLD"

- name: 'If Fact Matches - Enable TLD'
set_fact:
tldset: ',{{domain.stdout}},www.{{domain.stdout}}'
when: 'toplevel.stdout == pgrole'

- debug: msg="TLDSET is now for {{toplevel.stdout}}"
when: 'toplevel.stdout == pgrole'

- name: 'If Fact Does Not Match - Disable TLD'
set_fact:
tldset: ''
when: 'not toplevel.stdout == pgrole'

- debug: msg="TLD does not apply"
when: 'not toplevel.stdout == pgrole'

# EXTERNAL PORT FOR END BANNER
- name: Export Internal Port
shell: 'echo {{extport}} > /tmp/program_port'
ignore_errors: True

# FOR AUTHENTICATION
- name: 'Script Execute Part I'
shell: 'bash /opt/pgshield/drop.sh'

- name: 'Script Execute Part II'
shell: 'cat /var/plexguide/auth.var'
register: oauth

- name: 'OAuth Exe'
block:
- name: Check if Anti Auth Variable Exists
stat:
path: '/var/plexguide/auth/{{pgrole}}'
register: authcheck

- name: 'Auth Check 1'
set_fact:
gauth: 'http://oauth:4181'
when: not authcheck.stat.exists

- name: 'Auth Check 2'
set_fact:
gauth: ''
when: authcheck.stat.exists

when: oauth.stdout == 'good'

- name: 'OAuth Exe'
set_fact:
gauth: ''
when: not oauth.stdout == 'good'

- debug: msg="OAuth - {{oauth.stdout}}"

##PG-Core

##PG-Core
33 changes: 33 additions & 0 deletions menu/pgui/templates/old/_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Authors: Admin9705, Deiteq, and many PGBlitz Contributors
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
---
- cron:
name: Daily G/TDrive used space check | file checker
special_time: 'daily'
job: 'bash /opt/appdata/pgui/gtused.sh'
state: absent
ignore_errors: yes

- cron:
name: Daily G/TDrive used space check | file checker
special_time: 'daily'
job: 'bash /opt/appdata/pgui/check.sh'
state: absent
ignore_errors: yes

- cron:
name: Daily check for mgerfs / rclone new version
special_time: 'daily'
job: 'bash /opt/appdata/pgui/check.sh >/dev/null 2>&1'
state: present

- cron:
name: Daily G/TDrive used space checker | file & folder
special_time: 'daily'
job: 'bash /opt/appdata/pgui/gtused.sh >/dev/null 2>&1'
state: present
45 changes: 45 additions & 0 deletions menu/pgui/templates/old/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
#
# Title: PTS Community
# Author: MrDoob
# URL: WTFH >-!-< why you need this ^^
# GNU: General Public License v3.0
#
################################################################################
mkdir -p /var/plexguide/checkers
rm -rf /var/plexguide/checkers/*.log
#mkdir -p /var/plexguide/checkers

###mergerfs part
mgversion="$(curl -s https://api.github.com/repos/trapexit/mergerfs/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/mgfs.log
touch /var/plexguide/checkers/mergerfs.log

mergfs="$(mergerfs -v | grep 'mergerfs version:' | awk '{print $3}')"
echo "$mergfs" >> /var/plexguide/checkers/mgfs.log

mgstored="$(tail -n 1 /var/plexguide/checkers/mgfs.log)"

if [[ "$mgversion" == "$mgstored" ]];then
echo " ✅ No update needed !" >/var/plexguide/checkers/mergerfs.log
elif [[ "$mgversion" != "$mgstored" ]]; then
echo " ⛔ Update possible !" >/var/plexguide/checkers/mergerfs.log
else echo "stupid line"

fi
##### rclpone part
rcversion="$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/rclonestored.log
touch /var/plexguide/checkers/rclone.log
rcstored="$(rclone --version | awk '{print $2}' | tail -n 3 | head -n 1 )"
echo "$rcstored" >> /var/plexguide/checkers/rclonestored.log

rcstored="$(tail -n 1 /var/plexguide/checkers/rclonestored.log)"

if [[ "$rcversion" == "$rcstored" ]]; then
echo " ✅ No update needed !" >/var/plexguide/checkers/rclone.log
elif [[ "rcversion" != "rcstored" ]]; then
echo " ⛔ Update possible !" >/var/plexguide/checkers/rclone.log
else echo "stupid line"

fi
Loading

0 comments on commit 15d6162

Please sign in to comment.