Htaccess File

src/Hoektronics/BotQueue/master/web/.htaccess

REQUEST_FILENAME, REQUEST_URI
#    This file is part of BotQueue.
#
#    BotQueue 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.
#
#    BotQueue 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 BotQueue.  If not, see <http://www.gnu.org/licenses/>.

#setup our site configuration
Options -Indexes
DirectoryIndex dispatcher.php
RewriteEngine on

#does it exist?
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$  $1 [NC,L]

#this brings the site down
#RewriteCond %{REQUEST_URI} !^/admin
#RewriteCond %{REQUEST_URI} !^/ajax/admin
#RewriteRule (.*) down.html [NC,L]

#Secure our cookies a little better
php_flag session.cookie_httponly on

# make php handle local uploads up to 500M
php_value upload_max_filesize 500M
php_value post_max_size 500M
php_value memory_limit 512M

#ajax rule!
#RewriteRule ^ajax/([_a-zA-Z0-9]+)/([_a-zA-Z0-9]+)$    dispatcher.php?mode=ajax&controller=$1&view=$2 [NC,L]

# Dashboard ajax and templates
RewriteRule ^ajax/main/dashboard$     dispatcher.php?mode=ajax&controller=main&view=dashboard_data [NC,L]
RewriteRule ^ajax/main/dashboard/style/(list|large_thumbnails|medium_thumbnails|small_thumbnails)  dispatcher.php?mode=ajax&controller=main&view=dashboard_style&style=$1 [NC,L]
RewriteRule ^ajax/queue/update_sort$  dispatcher.php?mode=ajax&controller=queue&view=update_sort [NC,L]
RewriteRule ^ajax/bot/slice_config_select$  dispatcher.php?mode=ajax&controller=bot_edit&view=slice_config_select [NC,L]

#random stuff
RewriteRule ^$          dispatcher.php?controller=main&view=home [NC,L]
RewriteRule ^home$          dispatcher.php?controller=user&view=home [NC,L]
RewriteRule ^about$          dispatcher.php?controller=main&view=about [NC,L]
RewriteRule ^activity(/page:([0-9]+))?$          dispatcher.php?controller=main&view=activity&page=$2 [NC,L]

#user login action
RewriteRule ^login$          dispatcher.php?controller=user&view=loginandregister [NC,L]
RewriteRule ^login/([A-Za-z0-9+/=]+)$  dispatcher.php?controller=user&view=loginandregister&payload=$1 [NC,L]
RewriteRule ^token/([A-Za-z0-9+/=]+)$  dispatcher.php?controller=user&view=loginandregister&token=$1 [NC,L]
RewriteRule ^logout$          dispatcher.php?controller=auth&view=logout [NC,L]
RewriteRule ^forgotpass$        dispatcher.php?controller=auth&view=forgotpass [NC,L]
RewriteRule ^register$        dispatcher.php?controller=user&view=loginandregister [NC,L]
RewriteRule ^preferences$        dispatcher.php?controller=user&view=preferences [NC,L]

#admin area
RewriteRule ^admin$                            dispatcher.php?controller=admin&view=home [NC,L]

#Local file storage
RewriteRule ^local$                           dispatcher.php?controller=file&view=local [NC,L]
RewriteRule ^local/(.*)$                  dispatcher.php?controller=file&view=download&id=$1 [NC,L]

#queue stuff.
RewriteRule ^queues(/page:([0-9]+))?$                        dispatcher.php?controller=queue&view=home&page=$2 [NC,L]
RewriteRule ^queue/create$                        dispatcher.php?controller=queue&view=create [NC,L]
RewriteRule ^queue:([0-9]+)$                        dispatcher.php?controller=queue&view=view&id=$1 [NC,L]
RewriteRule ^queue:([0-9]+)/empty$                        dispatcher.php?controller=queue&view=flush&id=$1 [NC,L]
RewriteRule ^queue:([0-9]+)/edit$                        dispatcher.php?controller=queue&view=edit&id=$1 [NC,L]
RewriteRule ^queue:([0-9]+)/delete$                        dispatcher.php?controller=queue&view=delete&id=$1 [NC,L]
RewriteRule ^queue:([0-9]+)/jobs/(available|taken|qa|failure|complete)(/page:([0-9]+))?$                        dispatcher.php?controller=queue&view=listjobs&id=$1&status=$2&page=$4 [NC,L]

#uploader
RewriteRule ^upload$                        dispatcher.php?controller=upload&view=home [NC,L]
RewriteRule ^upload/url$                        dispatcher.php?controller=upload&view=url [NC,L,QSA]
RewriteRule ^upload/success$                        dispatcher.php?controller=upload&view=success [NC,L,QSA]

#bot stuff.
RewriteRule ^bots(/page:([0-9]+))?$                        dispatcher.php?controller=bot&view=home&page=$2 [NC,L]
RewriteRule ^bots/live$                            dispatcher.php?controller=bot&view=live [NC,L]
RewriteRule ^bot/register$                        dispatcher.php?controller=bot&view=register [NC,L]
RewriteRule ^bot:([0-9]+)$                        dispatcher.php?controller=bot&view=view&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/driverform:(dummy|printcore|s3g)/token:([0-9]+)$                        dispatcher.php?controller=bot_edit&mode=ajax&view=driver_form&id=$1&driver=$2&token_id=$3 [NC,L]
RewriteRule ^bot:([0-9]+)/setstatus/(idle|offline)$                        dispatcher.php?controller=bot&view=set_status&id=$1&status=$2 [NC,L]
RewriteRule ^bot:([0-9]+)/edit$                        dispatcher.php?controller=bot_edit&view=edit&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/edit/setup$                        dispatcher.php?controller=bot_edit&view=edit&id=$1&setup=true [NC,L]
RewriteRule ^bot:([0-9]+)/delete$                        dispatcher.php?controller=bot&view=delete&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/dropjob$                        dispatcher.php?controller=bot&view=dropjob&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/error                        dispatcher.php?controller=bot&view=error&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/jobs(/page:([0-9]+))?$                        dispatcher.php?controller=bot&view=listjobs&id=$1&page=$3 [NC,L]
RewriteRule ^bot:([0-9]+)/play$                        dispatcher.php?controller=bot&view=play&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/pause$                        dispatcher.php?controller=bot&view=pause&id=$1 [NC,L]
RewriteRule ^bot:([0-9]+)/retire$                       dispatcher.php?controller=bot&view=retire&id=$1

#jobs stuff.
RewriteRule ^jobs$                        dispatcher.php?controller=job&view=home [NC,L]
RewriteRule ^jobs/pretty$                        dispatcher.php?controller=job&view=pretty [NC,L]
RewriteRule ^jobs/(available|taken|failure|complete)(/page:([0-9]+))?$                        dispatcher.php?controller=job&view=listjobs&status=$1&page=$3 [NC,L]
RewriteRule ^job:([0-9]+)$                        dispatcher.php?controller=job&view=view&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/edit$                        dispatcher.php?controller=job&view=edit&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/delete$                        dispatcher.php?controller=job&view=delete&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/cancel$                        dispatcher.php?controller=job&view=cancel&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/qa$                        dispatcher.php?controller=job&view=qa&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/qa/pass$                        dispatcher.php?controller=job&view=qa_pass&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/qa/fail$                        dispatcher.php?controller=job&view=qa_fail&id=$1 [NC,L]
RewriteRule ^job:([0-9]+)/bump$                        dispatcher.php?controller=job&view=bump&id=$1 [NC,L]
RewriteRule ^job/create/file:([0-9]+)$                        dispatcher.php?controller=job&view=create&file_id=$1 [NC,L]
RewriteRule ^job/create/job:([0-9]+)$                        dispatcher.php?controller=job&view=create&job_id=$1 [NC,L]

#file stuff
RewriteRule ^file:([0-9]+)$                        dispatcher.php?controller=job&view=file&id=$1 [NC,L]
RewriteRule ^file:([0-9]+)/jobs(/page:([0-9]+))?$                        dispatcher.php?controller=job&view=file_jobs&id=$1&page=$3 [NC,L]
RewriteRule ^file:([0-9]+)/render$                        dispatcher.php?mode=ajax&controller=job&view=render_frame&id=$1 [NC,L,QSA]
RewriteRule ^passthru:([0-9]+)$                        dispatcher.php?controller=job&view=passthru&id=$1 [NC,L]

#help stuff.
RewriteRule ^help$                        dispatcher.php?controller=help&view=home [NC,L]
RewriteRule ^help/raspberry-pi-installation$                        dispatcher.php?controller=help&view=raspberry_pi_installation [NC,L]

#shortcode parsing
RewriteRule ^shortcode/([0-9a-zA-Z]+)?$                    dispatcher.php?controller=main&view=shortcode&code=$1 [NC,L]

#apps stuff.
RewriteRule ^apps$                              dispatcher.php?controller=app&view=home [NC,L]
RewriteRule ^app/register$                      dispatcher.php?controller=app&view=register_app [NC,L]
RewriteRule ^app:([0-9]+)$                      dispatcher.php?controller=app&view=view_app&app_id=$1 [NC,L]
RewriteRule ^app:([0-9]+)/edit$                  dispatcher.php?controller=app&view=edit_app&app_id=$1 [NC,L]
RewriteRule ^app:([0-9]+)/delete$                dispatcher.php?controller=app&view=delete_app&app_id=$1 [NC,L]
RewriteRule ^app/authorize$                      dispatcher.php?controller=app&view=authorize_app [NC,L,QSA]
RewriteRule ^app/token:([0-9]+)$                dispatcher.php?controller=app&view=view_token&id=$1 [NC,L]
RewriteRule ^app/token:([0-9]+)/edit$            dispatcher.php?controller=app&view=edit_token&id=$1 [NC,L]
RewriteRule ^app/token:([0-9]+)/revoke$          dispatcher.php?controller=app&view=revoke_app&id=$1 [NC,L]

#slicer stuff.
RewriteRule ^slicers$                              dispatcher.php?controller=slicer&view=home [NC,L]
RewriteRule ^slicer/create$                        dispatcher.php?controller=slicer&view=create [NC,L]
RewriteRule ^slicer/import$                      dispatcher.php?controller=slicer&view=import [NC,L]
RewriteRule ^slicer/createconfig$                  dispatcher.php?controller=slicer&view=config_create [NC,L]
RewriteRule ^slicer:([0-9]+)$                      dispatcher.php?controller=slicer&view=view&id=$1 [NC,L]
RewriteRule ^slicer:([0-9]+)/edit$                dispatcher.php?controller=slicer&view=edit&id=$1 [NC,L]
RewriteRule ^slicer:([0-9]+)/delete$              dispatcher.php?controller=slicer&view=delete&id=$1 [NC,L]
RewriteRule ^slicer:([0-9]+)/createconfig$        dispatcher.php?controller=slicer&view=config_create&id=$1 [NC,L]

#slice config stuff
RewriteRule ^sliceconfig:([0-9]+)$                      dispatcher.php?controller=slicer&view=config_view&id=$1 [NC,L]
RewriteRule ^sliceconfig:([0-9]+)/edit$                dispatcher.php?controller=slicer&view=config_edit&id=$1 [NC,L]
RewriteRule ^sliceconfig:([0-9]+)/delete$              dispatcher.php?controller=slicer&view=config_delete&id=$1 [NC,L]

#slice config stuff
RewriteRule ^slicejob:([0-9]+)$                      dispatcher.php?controller=slicer&view=job_view&id=$1 [NC,L]
RewriteRule ^slicejob:([0-9]+)/pass$                dispatcher.php?controller=slicer&view=job_update&id=$1&pass=1 [NC,L]
RewriteRule ^slicejob:([0-9]+)/fail$                dispatcher.php?controller=slicer&view=job_update&id=$1&fail=1 [NC,L]

#ugh, legal stuff
RewriteRule ^tos$                        dispatcher.php?controller=main&view=tos [NC,L]
RewriteRule ^privacy$                    dispatcher.php?controller=main&view=privacy [NC,L]
RewriteRule ^stats$                      dispatcher.php?controller=main&view=stats [NC,L]

#comments
RewriteRule ^comment/add$                            dispatcher.php?controller=comment&view=add_comment [NC,L]

#thingiverse
RewriteRule ^thingiverse$                            dispatcher.php?controller=thingiverse&view=main [NC,L]
RewriteRule ^thingiverse/url/([A-Za-z0-9+/=]+)$          dispatcher.php?controller=thingiverse&view=main&payload=$1 [NC,L]
RewriteRule ^thingiverse/callback$                  dispatcher.php?controller=thingiverse&view=thingiverse_callback [NC,L,QSA]

#api v1.
RewriteRule ^api/v1$                            dispatcher.php?controller=apiv1&view=home [NC,L]
RewriteRule ^api/v1/endpoint$                    apiv1.php [NC,L,QSA]

#notifications
RewriteRule ^notifications$                     dispatcher.php?controller=notifications&view=home [NC,L]
RewriteRule ^notifications/all$                 dispatcher.php?controller=notifications&view=all [NC,L]
RewriteRule ^notification/count$               dispatcher.php?mode=ajax&controller=notifications&view=count [NC,L]

#user profile stuff.
RewriteRule ^user:([0-9]+)$                        dispatcher.php?controller=user&view=profile&id=$1 [NC,L]
RewriteRule ^user/edit                            dispatcher.php?controller=user&view=edit [NC,L]
RewriteRule ^user/changepass$                        dispatcher.php?controller=user&view=changepass [NC,L]
RewriteRule ^user:([0-9]+)/changepass$                  dispatcher.php?controller=user&view=changepass&id=$1 [NC,L]
RewriteRule ^user:([0-9]+)/edit$                      dispatcher.php?controller=user&view=edit&id=$1 [NC,L]
RewriteRule ^user:([0-9]+)/delete$                    dispatcher.php?controller=user&view=delete&id=$1 [NC,L]
RewriteRule ^user:([0-9]+)/resetpass:([0-9a-zA-Z]{40})$          dispatcher.php?controller=user&view=resetpass&id=$1&hash=$2 [NC,L]
RewriteRule ^user:([0-9]+)/activity(/page:([0-9]+))?$            dispatcher.php?controller=user&view=activity&id=$1&page=$3 [NC,L]

#username wildcard pages.  must be at the very end to avoid conflicting with other pages
RewriteRule ^([-_a-zA-Z0-9]+)$                      dispatcher.php?controller=user&view=profile&username=$1 [NC,L]
RewriteRule ^([-_a-zA-Z0-9]+)/changepass$             dispatcher.php?controller=user&view=changepass&username=$1 [NC,L]
RewriteRule ^([-_a-zA-Z0-9]+)/edit$                    dispatcher.php?controller=user&view=edit&username=$1 [NC,L]
RewriteRule ^([-_a-zA-Z0-9]+)/delete$                    dispatcher.php?controller=user&view=delete&username=$1 [NC,L]
RewriteRule ^([-_a-zA-Z0-9]+)/resetpass:([0-9a-zA-Z]{40})$        dispatcher.php?controller=user&view=resetpass&username=$1&hash=$2 [NC,L]
RewriteRule ^([-_a-zA-Z0-9]+)/activity(/page:([0-9]+))?$            dispatcher.php?controller=user&view=activity&id=username&page=$3 [NC,L]
Exit mobile version