parent
4cbfe6d0fc
commit
665dca80d0
4 changed files with 51 additions and 9 deletions
13
ansible/templates/nginx.conf
vendored
13
ansible/templates/nginx.conf
vendored
|
@ -50,7 +50,6 @@ server {
|
|||
client_max_body_size 50M;
|
||||
|
||||
location / {
|
||||
rewrite (\/(user|(?<!feeds\/)u\/|(?<!feeds\/)inbox|post|community|(?<!feeds\/)c\/|create_post|create_community|login|search|setup|sponsors|communities|modlog|home|password_change)+) /static/index.html break;
|
||||
proxy_pass http://0.0.0.0:8536;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
|
@ -73,4 +72,16 @@ server {
|
|||
expires max;
|
||||
}
|
||||
}
|
||||
# Anonymize IP addresses
|
||||
# https://www.supertechcrew.com/anonymizing-logs-nginx-apache/
|
||||
map $remote_addr $remote_addr_anon {
|
||||
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
|
||||
~(?P<ip>[^:]+:[^:]+): $ip::;
|
||||
127.0.0.1 $remote_addr;
|
||||
::1 $remote_addr;
|
||||
default 0.0.0.0;
|
||||
}
|
||||
log_format main '$remote_addr_anon - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" "$http_user_agent"';
|
||||
access_log /dev/stdout main;
|
||||
}
|
||||
|
|
|
@ -198,20 +198,51 @@ fn main() {
|
|||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.data(server.clone())
|
||||
// Front end routes
|
||||
.service(actix_files::Files::new("/static", front_end_dir()))
|
||||
.route("/", web::get().to(index))
|
||||
.route(
|
||||
"/home/type/{type}/sort/{sort}/page/{page}",
|
||||
web::get().to(index),
|
||||
)
|
||||
.route("/login", web::get().to(index))
|
||||
.route("/create_post", web::get().to(index))
|
||||
.route("/create_community", web::get().to(index))
|
||||
.route("/communities/page/{page}", web::get().to(index))
|
||||
.route("/communities", web::get().to(index))
|
||||
.route("/post/{id}/comment/{id2}", web::get().to(index))
|
||||
.route("/post/{id}", web::get().to(index))
|
||||
.route("/c/{name}/sort/{sort}/page/{page}", web::get().to(index))
|
||||
.route("/c/{name}", web::get().to(index))
|
||||
.route("/community/{id}", web::get().to(index))
|
||||
.route(
|
||||
"/u/{username}/view/{view}/sort/{sort}/page/{page}",
|
||||
web::get().to(index),
|
||||
)
|
||||
.route("/u/{username}", web::get().to(index))
|
||||
.route("/user/{id}", web::get().to(index))
|
||||
.route("/inbox", web::get().to(index))
|
||||
.route("/modlog/community/{community_id}", web::get().to(index))
|
||||
.route("/modlog", web::get().to(index))
|
||||
.route("/setup", web::get().to(index))
|
||||
.route(
|
||||
"/search/q/{q}/type/{type}/sort/{sort}/page/{page}",
|
||||
web::get().to(index),
|
||||
)
|
||||
.route("/search", web::get().to(index))
|
||||
.route("/sponsors", web::get().to(index))
|
||||
.route("/password_change/{token}", web::get().to(index))
|
||||
// Websocket
|
||||
.service(web::resource("/api/v1/ws").to(chat_route))
|
||||
// .service(web::resource("/api/v1/rest").route(web::post().to(||{})))
|
||||
.service(web::resource("/").to(index))
|
||||
// NodeInfo
|
||||
.route("/nodeinfo/2.0.json", web::get().to(nodeinfo::node_info))
|
||||
.route(
|
||||
"/.well-known/nodeinfo",
|
||||
web::get().to(nodeinfo::node_info_well_known),
|
||||
)
|
||||
// RSS
|
||||
.route("/feeds/{type}/{name}.xml", web::get().to(feeds::get_feed))
|
||||
// TODO: probably need a different function for this (or just handle all of /feeds?
|
||||
// TODO: would be nice to use ListingType, but that doesnt include user
|
||||
.route("/feeds/all.xml", web::get().to(feeds::get_all_feed))
|
||||
// static resources
|
||||
.service(actix_files::Files::new("/static", front_end_dir()))
|
||||
})
|
||||
.bind((settings.bind, settings.port))
|
||||
.unwrap()
|
||||
|
|
2
ui/src/index.tsx
vendored
2
ui/src/index.tsx
vendored
|
@ -38,11 +38,11 @@ class Index extends Component<any, any> {
|
|||
<Navbar />
|
||||
<div class="mt-4 p-0">
|
||||
<Switch>
|
||||
<Route exact path={`/`} component={Main} />
|
||||
<Route
|
||||
path={`/home/type/:type/sort/:sort/page/:page`}
|
||||
component={Main}
|
||||
/>
|
||||
<Route exact path={`/`} component={Main} />
|
||||
<Route path={`/login`} component={Login} />
|
||||
<Route path={`/create_post`} component={CreatePost} />
|
||||
<Route path={`/create_community`} component={CreateCommunity} />
|
||||
|
|
2
ui/src/utils.ts
vendored
2
ui/src/utils.ts
vendored
|
@ -197,7 +197,7 @@ export async function getPageTitle(url: string) {
|
|||
|
||||
export function debounce(
|
||||
func: any,
|
||||
wait: number = 500,
|
||||
wait: number = 1000,
|
||||
immediate: boolean = false
|
||||
) {
|
||||
// 'private' variable for instance
|
||||
|
|
Loading…
Reference in a new issue