added automated deploy
This commit is contained in:
parent
92445a37ca
commit
6a57963ebc
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
index.html
|
118
README.md
118
README.md
@ -1,5 +1,5 @@
|
|||||||
# ./Startpage.sh
|
# ./startpage.sh
|
||||||
A simple tree style startpage in HTML and CSS with interchangeable and customisable themes.
|
A simple configurable tree style startpage in HTML and CSS with interchangeable and customisable themes.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -22,94 +22,40 @@ A simple tree style startpage in HTML and CSS with interchangeable and customisa
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Themes
|
### General
|
||||||
|
Configure your starttree in the `config.yml` file like so:
|
||||||
|
|
||||||
#### Choosing themes
|
```yaml
|
||||||
1. Open the index.html file in your favorite text editor.
|
- theme: "black"
|
||||||
2. Find the line that starts with `<link href="themes/` in the `<head>` section.
|
- clock: true
|
||||||
3. Replace themes/*theme*.css with your desired theme. Themes can be found in the themes folder.
|
- username: "root"
|
||||||
|
- hostname: "startpage"
|
||||||
### Trees
|
- num_trees: 3
|
||||||
|
- trees:
|
||||||
#### Changing tree title
|
- title: "General"
|
||||||
1. Open the index.html file in your favorite text editor.
|
- items:
|
||||||
2. Find your desired tree and look for the `<!--TREE TITLE-->` comment.
|
- gmail: "https://mail.google.com"
|
||||||
3. Replace the text between the `<span>` tags.
|
- github: "https://github.com"
|
||||||
|
- title: "Entertainment"
|
||||||
#### Changing branch content
|
- items:
|
||||||
1. Open the index.html file in your favorite text editor.
|
- youtube: "https://www.youtube.com/"
|
||||||
2. Find your desired branch
|
- reddit: "https://reddit.com/"
|
||||||
3. To change the text, replace the content of the `<a>` tags.
|
- title: "Work"
|
||||||
4. To change the link change the content of the `href=""` attribute above the text.
|
- items:
|
||||||
|
- git: "https://git.work.org"
|
||||||
#### Adding Branches
|
- homepage: "https://www.work.org"
|
||||||
1. Open the index.html file in your favorite text editor.
|
- search: true
|
||||||
2. Add
|
- search_name: "brave"
|
||||||
|
- search_url: "https://search.brave.com/search"
|
||||||
|
- search_query: "q"
|
||||||
```
|
```
|
||||||
<li>
|
|
||||||
<a href="/link/to/site">
|
|
||||||
text
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
```
|
|
||||||
before or after another branch.
|
|
||||||
|
|
||||||
#### Adding Trees
|
You can find all themes in the `themes/` directory.
|
||||||
1. Open the index.html file in your favorite text editor.
|
|
||||||
2. Add
|
|
||||||
```
|
|
||||||
<div class="title rX_REPLACE_ME">
|
|
||||||
<h4>
|
|
||||||
<!--TREE TITLE-->
|
|
||||||
<span class="cmd-cmd">Title:</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
<div class="tree rX_REPLACE_ME">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="/link/to/site">
|
|
||||||
text
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
```
|
|
||||||
Where X_REPLACE_ME is the number of your Tree with a maximum of 4.
|
|
||||||
|
|
||||||
|
### Search
|
||||||
|
To configure your search, search for something in your favorite search engine. The URL will look something like this:
|
||||||
|
|
||||||
### Clock
|
`https://www.startpage.com/sp/search?query=something`
|
||||||
|
|
||||||
#### Removing Clock
|
In this case the `search_url` would be `https://www.startpage.com/sp/search` and the `search_query` would be `query`.
|
||||||
1. Open the index.html file in your favorite text editor.
|
|
||||||
2. Find and remove the line `<div id="clock"></div>`.
|
|
||||||
|
|
||||||
#### Adding Clock
|
|
||||||
1. Open the index.html file in your favorite text editor.
|
|
||||||
2. Add the line `<div id="clock"></div>` at the top of the `<body>` section.
|
|
||||||
|
|
||||||
#### Changing Clock to American style
|
|
||||||
1. Open the clock.js file in your favorite text editor.
|
|
||||||
2. Remove the comments (`/* */`).
|
|
||||||
3. Remove the comment (`//`) before your desired time format. You can find an explanation for each on the right side of the code.
|
|
||||||
4. Comment out old Clock style with `//`.
|
|
||||||
|
|
||||||
#### Changing Clock back to Normal style
|
|
||||||
1. Open the clock.js in your favorite text editor.
|
|
||||||
2. Put a multi-line-comment start (`/*`) before `let period = "AM"`.
|
|
||||||
3. Put a multi-line-comment end (`*/`) after `period = "PM" }`.
|
|
||||||
|
|
||||||
### Search Engine
|
|
||||||
|
|
||||||
#### Choosing Search Engine
|
|
||||||
1. Open the index.html file in your favorite text editor.
|
|
||||||
2. Find the `<form>` tags
|
|
||||||
3. Change the content of the `action=""` attribute to your search Engine
|
|
||||||
4. Change the content of the `name=""` attribute in the `<input>` \
|
|
||||||
\
|
|
||||||
Example for startpage search engine:
|
|
||||||
````
|
|
||||||
<form action="https://startpage.com/sp/search" method="GET" class="search-form">
|
|
||||||
<h4 class="search-title">Search: </h4>
|
|
||||||
<input type="text" name="query" autofocus class="search-input" />
|
|
||||||
</form>
|
|
||||||
````
|
|
||||||
5. **Optional**: Find the `<span class="cmd-cmd">./search -e brave</span>` element and change `brave` to your search engine's name.
|
|
22
config.yml
Normal file
22
config.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
- theme: "black"
|
||||||
|
- clock: true
|
||||||
|
- username: "root"
|
||||||
|
- hostname: "startpage"
|
||||||
|
- num_trees: 3
|
||||||
|
- trees:
|
||||||
|
- title: "General"
|
||||||
|
- items:
|
||||||
|
- gmail: "https://mail.google.com"
|
||||||
|
- github: "https://github.com"
|
||||||
|
- title: "Entertainment"
|
||||||
|
- items:
|
||||||
|
- youtube: "https://www.youtube.com/"
|
||||||
|
- reddit: "https://reddit.com/"
|
||||||
|
- title: "Work"
|
||||||
|
- items:
|
||||||
|
- git: "https://git.work.org"
|
||||||
|
- homepage: "https://www.work.org"
|
||||||
|
- search: true
|
||||||
|
- search_name: "brave"
|
||||||
|
- search_url: "https://search.brave.com/search"
|
||||||
|
- search_query: "q" # ?q=YourSearchQuery
|
88
deploy.py
Normal file
88
deploy.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
with open("config.yml", "r") as stream:
|
||||||
|
try:
|
||||||
|
config = yaml.safe_load(stream)
|
||||||
|
#print(config)
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
print(exc)
|
||||||
|
exit
|
||||||
|
|
||||||
|
startpage = f"""
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
||||||
|
<title>New Tab</title>
|
||||||
|
<!--THEME-->
|
||||||
|
<link href="themes/{config[0]["theme"]}.css" rel="stylesheet" type="text/css" />
|
||||||
|
</head>
|
||||||
|
<body>"""
|
||||||
|
|
||||||
|
if config[1]['clock']:
|
||||||
|
startpage += """
|
||||||
|
<div id="clock"></div>
|
||||||
|
<script src="clock.js"></script>"""
|
||||||
|
|
||||||
|
prompt = '#' if config[2]['username'] == 'root' else '$'
|
||||||
|
|
||||||
|
startpage += f"""
|
||||||
|
<div id="parent">
|
||||||
|
<h4>
|
||||||
|
<span class="cmd-dir">[{config[2]['username']}@{config[3]['hostname']}:~] </span>
|
||||||
|
<span class="cmd-dollar">{prompt}</span>
|
||||||
|
<span class="cmd-cmd">./startpage.sh</span>
|
||||||
|
</h4>
|
||||||
|
<div id="trees">
|
||||||
|
"""
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
while i < int(config[4]['num_trees']) * 2:
|
||||||
|
startpage += f"""
|
||||||
|
<div class="title" style="grid-column: {i+1}">
|
||||||
|
<h4>
|
||||||
|
<!--TREE TITLE-->
|
||||||
|
<span class="cmd-cmd">{config[5]['trees'][i]['title']}:</span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="tree" style="grid-column: {i+1}">
|
||||||
|
<ul>
|
||||||
|
"""
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
for j in range(len(config[5]['trees'][i]['items'])):
|
||||||
|
for name, url in (config[5]['trees'][i]['items'][j]).items():
|
||||||
|
startpage += f"<li><a href='{url}'>{name}</a></li>\n"
|
||||||
|
|
||||||
|
startpage += "</ul>\n</div>\n"
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
startpage += "</div>"
|
||||||
|
|
||||||
|
if config[6]['search']:
|
||||||
|
startpage += f"""
|
||||||
|
<h4>
|
||||||
|
<span class="cmd-dir">[{config[2]['username']}@{config[3]['hostname']}:~]</span>
|
||||||
|
<span class="cmd-dollar">{prompt}</span>
|
||||||
|
<span class="cmd-cmd">./search.sh -e {config[7]['search_name']}</span>
|
||||||
|
</h4>
|
||||||
|
<form action="{config[8]['search_url']}" method="GET" class="search-form">
|
||||||
|
<h4 class="search-title"> Search: </h4>
|
||||||
|
<input type="text" name="{config[9]['search_query']}" autofocus class="search-input" />
|
||||||
|
</form>"""
|
||||||
|
|
||||||
|
startpage += """
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
f = open("index.html", "w")
|
||||||
|
f.write(startpage)
|
||||||
|
f.close()
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
pyyaml
|
Loading…
x
Reference in New Issue
Block a user