1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import os.path
import datetime
class Config:
__DIR = os.path.dirname(__file__)
ASSETS_IMPORT_PATH = "/assets"
ASSETS_IMPORT_PATH_STATIC = "https://static.wazul.moe"
MAIN_ROOT_URL = "https://wazul.moe"
GIT_ROOT_URL = "https://git.wazul.moe"
RSS_FILE_NAME = "feed.xml"
TIMEZONE = datetime.timezone(datetime.timedelta(hours=2))
# BLOG
BLOG_ROOT_URL = "https://blog.wazul.moe"
BLOG_ASSETS_SOURCE_DIR = os.path.join(__DIR, "blog/assets")
TEMPLATES_SOURCE_DIR = [os.path.join(__DIR, "blog/templates"), os.path.join(__DIR, "comic/templates"), os.path.join(__DIR, "codenames/templates")]
POST_SOURCE_DIR = os.path.join(__DIR, "blog/posts")
BLOG_HOSTNAME = "yggdrasil"
BLOG_NAME = "@{}".format(BLOG_HOSTNAME)
BLOG_SUBTITLE = "The chronicle of my works and learnings"
BLOG_USER = "reader"
BLOG_OWNER = "http"
@staticmethod
def get_prompt(path: str, cmd: str) -> str:
return "<span class=\"green\">{}@{}</span> <span class=\"red\">{} $</span> {}".format(Config.BLOG_USER, Config.BLOG_HOSTNAME, path, cmd)
@staticmethod
def get_tag_prompt(tag: str, cmd: str) -> str:
return Config.get_prompt("~/tags/{}".format("" if tag == "" else tag + "/"), cmd)
# COMIC
COMIC_NAME = "Comics by Wazul"
COMIC_ROOT_URL = "https://comic.wazul.moe"
ISSUE_SOURCE_DIR = os.path.join(__DIR, "comic/issues")
COMIC_ASSETS_SOURCE_DIR = os.path.join(__DIR, "comic/assets")
# CODENAMES
CODENAMES_NAME = "Codenames Grid Generator"
CODENAMES_ROOT_URL = "https://codenames.wazul.moe"
CODENAMES_ASSETS_SOURCE_DIR = os.path.join(__DIR, "codenames/assets")
# HELPER FUNCTIONS
@staticmethod
def change_url_to_local(url: str) -> str:
return url.replace("https://", "http://").replace("wazul.moe", "localhost")
@staticmethod
def change_config_to_local():
Config.ASSETS_IMPORT_PATH_STATIC = Config.change_url_to_local(Config.ASSETS_IMPORT_PATH_STATIC)
Config.MAIN_ROOT_URL = Config.change_url_to_local(Config.MAIN_ROOT_URL)
Config.GIT_ROOT_URL = Config.change_url_to_local(Config.GIT_ROOT_URL)
Config.BLOG_ROOT_URL = Config.change_url_to_local(Config.BLOG_ROOT_URL)
Config.COMIC_ROOT_URL = Config.change_url_to_local(Config.COMIC_ROOT_URL)
Config.CODENAMES_ROOT_URL = Config.change_url_to_local(Config.CODENAMES_ROOT_URL)
|