tk100/ScriptsApp
Web app for displaying the scripts generated from "ScriptsTemplates".
https://scripts.phscs.de
- JavaScript 73.6%
- CSS 17.8%
- HTML 8.6%
| app | feat: uniform style with bicolored icons | |
| bin | feat: english translation; provide icense for external libs | |
| .gitignore | feat: complete redesign of web app in vanilla js | |
| .prettierignore | feat: complete redesign of web app in vanilla js | |
| .prettierrc.json | feat: complete redesign of web app in vanilla js | |
| eslint.config.js | feat: complete redesign of web app in vanilla js | |
| index-config.example.json | Version 3.0 | |
| LICENSE.md | feat: uniform style with bicolored icons | |
| package.json | feat: uniform style with bicolored icons | |
| README.md | feat: uniform style with bicolored icons | |
ScriptsApp
This repository consists of two components:
- A Node.js script "bin/createIndex.sh" that prepares the scripts (see eepository "ScriptsTemplates" (https://codeberg.org/tk100/ScriptsTemplates)) for publication.
- Sort all necessary files into the folders
app/open,app/ticket, andapp/private - Create two index files in JSON format:
app/open/index.jsonfor public content,app/private/index.jsonfor all content
- Web application for publishing scripts (like for example PHySiCS – Materialien
- HTML pages in the
appfolder - JavaScript files in the
app/jsfolder - Assets in the
app/iconsandapp/cssfolders
The web application is currently only available in German. I would appreciate your support if you would like to enable support for other languages in the code.
Preparation
- Clone the repository:
git clone https://codeberg.org/tk100/ScriptsApp.git
- Adjust the configuration for generating the index files:
cd ScriptsApp
cp index-config.example.json index-config.json
Edit index-config.json:
- "srcDir": Path to the main folder where the scripts are located
- "dstDir": Path to the folder that will later be uploaded to the web server (do not change)
- "excludeSubjects": List of subjects to exclude, e.g., ["Mathematics"]
- "allowedTypes": List of allowed types, e.g., ["script", "slides", "index", "link", "exercise", "solution", "h5p", "geogebra"]
- Adjust the web application configuration:
cd app
cp app-config-example.js app-config.json
Edit app-config.json:
- "title": Title of the website
- "legalUrl": Optional link to the legal notice
- "privacyUrl": Optional link to the privacy policy
- "customIcons": Show custom icons (property "icon" in access.json)
- Configure web server
IMPORTANT Directory protection (basic authentication) must be set up for the app/private subdirectory on the target web server. This can be done via the provider's interface or a separate .htaccess file.
Update Scripts (build process)
npm run index
Overall Implementation Flow:
- Each learning area contains an
access.jsonfile. - Every document (entry in "contents") has the attribute "access".
- If
access="private", the document is sorted into theprivatefolder. - If
access="ticket", the document is copied into theticketfolder, but with a cryptic directory name (the value of "ticket" in theaccess.jsonfile). Only those who know the link can access it (this is equivalent to sharing via a link). - If
access="open, the document is copied, this time with a normal directory name (so that it could be guessed with a little patience...).
Deployment
- Local Test
Test the app locally before the actual deployment:
npm run dev
Now open the address "http://localhost:8080" in your browser.
- Upload
- Copy all files from the
appfolder to your web server.
- Test
- You should only see the public scripts when accessing the index.html file.
- Does the browser prompt for a password if "Anmelden" is clicked?
- Are all scripts visible after logging in?