Skip to content

Commit 2e3fa3e

Browse files
authored
Merge branch 'proxy' into server-migration
2 parents fa77625 + 25e12bc commit 2e3fa3e

File tree

20 files changed

+135
-91
lines changed

20 files changed

+135
-91
lines changed

data/nginx-vue/conf.d/default.conf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
#access_log /var/log/nginx/host.access.log main;
6+
7+
location / {
8+
root /usr/share/nginx/html;
9+
index index.html index.htm;
10+
}
11+
12+
#error_page 404 /404.html;
13+
14+
# redirect server error pages to the static page /50x.html
15+
#
16+
error_page 500 502 503 504 /50x.html;
17+
error_page 404 =200 /index.html;
18+
location = /50x.html {
19+
root /usr/share/nginx/html;
20+
}
21+
22+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
23+
#
24+
#location ~ \.php$ {
25+
# proxy_pass http://127.0.0.1;
26+
#}
27+
28+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29+
#
30+
#location ~ \.php$ {
31+
# root html;
32+
# fastcgi_pass 127.0.0.1:9000;
33+
# fastcgi_index index.php;
34+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35+
# include fastcgi_params;
36+
#}
37+
38+
# deny access to .htaccess files, if Apache's document root
39+
# concurs with nginx's one
40+
#
41+
#location ~ /\.ht {
42+
# deny all;
43+
#}
44+
}

docker-compose.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,7 @@ services:
44
build: .
55
ports:
66
- "80:80"
7-
links:
8-
- epochtalk
9-
environment:
10-
BASE_URL: "http://localhost:8080"
11-
epochtalk:
12-
image: quay.io/epochtalk/epochtalk:ui-refactor-2020
13-
ports:
14-
- "8080:8080"
15-
- "23958:23958"
16-
depends_on:
17-
- redis
18-
- postgres
19-
- epoch
20-
links:
21-
- redis
22-
- postgres
237
env_file:
24-
- epochtalk-docker.env
25-
epoch:
26-
image: quay.io/epochtalk/epoch:v1.14.0
27-
depends_on:
28-
- postgres
29-
links:
30-
- postgres
31-
environment:
32-
MIX_ENV: prod
33-
DATABASE_USER: docker
34-
DATABASE_PASSWORD: docker
35-
DATABASE_NAME: epochtalk
36-
DATABASE_HOST: postgres
37-
redis:
38-
image: redis:4.0.1
39-
user: redis
40-
postgres:
41-
image: postgres:11.1
42-
environment:
43-
POSTGRES_USER: docker
44-
POSTGRES_PASSWORD: docker
8+
- epochtalk-vue.env
459
volumes:
46-
- ./db:/var/lib/postgresql/data
10+
- ./data/nginx-vue/conf.d:/etc/nginx/conf.d

example.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
# When adding a new env variable,
2+
# make sure to add an entry to:
3+
# src/config.json (dev)
4+
# and
5+
# src/docker-config.json (prod)
16
VUE_APP_BACKEND_URL=http://localhost:4000
27
VUE_APP_OLD_BACKEND_URL=http://localhost:8080
8+
VUE_APP_API_KEY=ABC123

public/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="/favicon.ico">
8-
<title><%= htmlWebpackPlugin.options.title %></title>
8+
<title>Bitcoin Forum</title>
99
</head>
1010
<body>
1111
<noscript>
12-
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
12+
<strong>We're sorry but Bitcoin Forum doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
1313
</noscript>
1414
<div id="app"></div>
1515
<div id="modals"></div>
1616
<!-- built files will be auto injected -->
1717
<script id="config-remote" async>
1818
window.configScript = document.createElement('script')
19-
window.configScript.src = '<%= process.env.VUE_APP_BACKEND_URL%>/config.js'
19+
window.configScript.src = '<%= process.env.VUE_APP_BACKEND_URL || "$VUE_APP_BACKEND_URL"%>/config.js'
2020
window.configScript.type = 'text/javascript'
2121

2222
// Try to append config from backend

src/api/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ export const $axios = axios.create({
1111
})
1212
export const $axios2 = axios.create({
1313
baseURL: process.env.VUE_APP_BACKEND_URL || config.VUE_APP_BACKEND_URL,
14-
timeout: 3000,
14+
timeout: 15000,
1515
crossDomain: true
1616
})
1717

1818
const $auth = localStorageCache(0, 'app').get('auth')
1919
const initUser = $auth ? $auth.data : undefined
2020
if (initUser) { $axios2.defaults.headers.common['Authorization'] = `BEARER ${initUser.token}` }
21+
$axios2.defaults.headers.common['api-key'] = process.env.VUE_APP_API_KEY || config.VUE_APP_API_KEY
22+
2123
/* provided methods */
2224
const $http = (path, opts, handleErrors) => {
2325
opts = opts || {}
@@ -208,7 +210,7 @@ export const usersApi = {
208210
memberSearch: params => $http('/api/search/users', { params }),
209211
lookup: (username, params) => $http(`/api/users/lookup/${username}`, { params }),
210212
update: (userId, data) => $http(`/api/users/${userId}`, { method: 'PUT', data }),
211-
find: username => $http2(`/api/users/${username}`),
213+
find: id => $http2(`/api/users/byid?id=${id}`),
212214
delete: userId => $http(`/api/users/${userId}`, { method: 'DELETE' }),
213215
deactivate: userId => $http(`/api/users/${userId}/deactivate`, { method: 'POST' }),
214216
reactivate: userId => $http(`/api/users/${userId}/reactivate`, { method: 'POST' }),

src/components/layout/HeaderComponent.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<h1 :class="{ 'hide-mobile': adminMode }">
7676
<router-link to="/" v-if="logo"><img :src="logo" id="logo" /></router-link>
7777
<router-link id="logo-text" to="/">
78-
{{decode(title)}}
78+
Bitcoin Forum
7979
</router-link>
8080
<span>&nbsp;{{decode(revision)}}</span>
8181
</h1>
@@ -84,10 +84,15 @@
8484
<!-- Login Section -->
8585
<ul class="signed-out" v-if="!loggedIn">
8686
<li>
87-
<a href="" @click.prevent="showRegister = true">REGISTER</a>
87+
<!-- <a href="" @click.prevent="showRegister = true" disabled="true">REGISTER</a> -->
88+
<span>REGISTER</span>
8889
</li>
8990
<li>
90-
<a href="" id="login-link" @click.prevent="showLogin = true">LOGIN</a>
91+
<!-- <a href="" id="login-link" @click.prevent="showLogin = true" disabled="true">LOGIN</a> -->
92+
<span>LOGIN</span>
93+
</li>
94+
<li>
95+
<a href="https://forms.clickup.com/57751/f/1rcq-791/HNWSBPWCDSRMDMS9TF" target="_blank">REPORT A BUG</a>
9196
</li>
9297
</ul>
9398

@@ -659,11 +664,16 @@ header {
659664
cursor: pointer;
660665
}
661666
&.signed-out li { padding-left: 1.25rem; }
662-
&.signed-out li a {
667+
&.signed-out li a, &.signed-out li span {
663668
display: table-cell;
664669
height: inherit;
665670
vertical-align: middle;
666671
}
672+
li span {
673+
cursor: not-allowed;
674+
color: $secondary-font-color;
675+
font-size: $header-login-font-size;
676+
}
667677
li a {
668678
color: $header-login-font-color;
669679
font-size: $header-login-font-size;

src/components/layout/Pagination.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
if (query.page === 1 || !query.page) delete query.page
4141
if (query.start) delete query.start
4242
if (props.page !== v.currentPage) {
43-
$router.replace({ name: $route.name, params: params, query: query })
43+
$router.push({ name: $route.name, params: params, query: query })
4444
}
4545
}
4646

src/components/threads/RecentThreads.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<router-link v-if="thread?.board" class="thread-board" :title="decode(thread.board.name)" :to="{ name: 'Threads', params: { boardSlug: thread.board.slug } }" onclick="event.stopPropagation()"><span v-html="decode(thread.board.name)"></span></router-link>
6363
by
6464
<span v-if="thread.deleted">deleted</span>
65-
<router-link onclick="event.stopPropagation()" v-if="!thread.deleted" :to="{ path: '/profile/' + thread?.user?.username.toLowerCase() }">{{thread?.user?.username}}</router-link>
65+
<router-link onclick="event.stopPropagation()" v-if="!thread.deleted" :to="{ path: '/profile/' + thread?.user?.username.toLowerCase(), query: { id: thread?.user?.id } }">{{thread?.user?.username}}</router-link>
6666
</div>
6767
<div class="last-reply">
6868
<div>{{humanDate(thread?.post?.created_at)}}</div>

src/components/users/RankDisplay.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default {
1616
const init = u => {
1717
const rankMap = u.metadata.ranks
1818
const metricToRankMaps = u.metadata.rank_metric_maps
19-
let ranks = Object.keys(metricToRankMaps).reduce((mappedRanks, metricName) => {
19+
if (metricToRankMaps) {
20+
let ranks = Object.keys(metricToRankMaps).reduce((mappedRanks, metricName) => {
2021
let rank = -1
2122
for (let i = 0; i < metricToRankMaps[metricName].length; i++) {
2223
if (u[metricName] >= metricToRankMaps[metricName][i]) rank = i
@@ -31,6 +32,7 @@ export default {
3132
3233
if (lowestRankNumber >= 0) v.userRank = rankMap[lowestRankNumber].name
3334
else v.userRank = ''
35+
} else v.userRank = ''
3436
}
3537
3638
init(v.user)

src/components/users/UserPosts.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default {
115115
next(vm => {
116116
const params = {
117117
username: to.params.username,
118+
id: to.query.id,
118119
limit: localStoragePrefs().data.posts_per_page,
119120
page: to.query.page || 1,
120121
field: to.query.field,
@@ -131,6 +132,7 @@ export default {
131132
beforeRouteUpdate(to, from, next) {
132133
const params = {
133134
username: to.params.username,
135+
id: to.query.id,
134136
limit: localStoragePrefs().data.posts_per_page,
135137
page: to.query.page || 1,
136138
field: to.query.field,
@@ -158,6 +160,7 @@ export default {
158160
const refresh = () => {
159161
const params = {
160162
username: $route.params.username,
163+
id: $route.query.id,
161164
limit: v.prefs.posts_per_page,
162165
page: $route.query.page || 1,
163166
field: $route.query.field,
@@ -169,8 +172,8 @@ export default {
169172
170173
const toggleThreads = threads => {
171174
const params = { ...$route.params, saveScrollPos: true }
172-
if (threads) $router.replace({ name: $route.name, params: params, query: { threads }})
173-
else $router.replace({ name: $route.name, params: params })
175+
if (threads) $router.replace({ name: $route.name, params: params, query: { threads: threads, id: $route.query.id }})
176+
else $router.replace({ name: $route.name, params: params, query: { id: $route.query.id }})
174177
v.threads = threads
175178
}
176179

0 commit comments

Comments
 (0)