Skip to content

Commit b3b90da

Browse files
committed
Merge remote-tracking branch 'origin/dev'
# Conflicts: # public/img/screenshots/screenshot.jpg
2 parents 5ef830d + 8c30fb7 commit b3b90da

File tree

66 files changed

+2280
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2280
-486
lines changed

.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
REACT_APP_API_URL=http://localhost:8000
1+
REACT_APP_API_URL=http://localhost:8000
2+
3+
PUBLIC_URL=https://sdn-host.net/public/
4+
5+
CDN_HOST=some-ftp-host.com
6+
CDN_LOGIN=gitcom
7+
CDN_PASSWORD=your-password

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitcom-front",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"private": true,
55
"dependencies": {
66
"@azure/ms-rest-js": "^2.0.5",
@@ -46,5 +46,6 @@
4646
"last 1 firefox version",
4747
"last 1 safari version"
4848
]
49-
}
49+
},
50+
"devDependencies": {}
5051
}
Lines changed: 1 addition & 0 deletions
Loading
21.8 KB
Loading

public/index.html

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<noscript>You need to enable JavaScript to run this app.</noscript>
1616
<div id="root"></div>
1717
<div id="fb-root"></div>
18+
<script src="https://gumroad.com/js/gumroad.js"></script>
1819
<!-- Global site tag (gtag.js) - Google Analytics -->
1920
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-153205738-3"></script>
2021
<script>
@@ -24,34 +25,5 @@
2425

2526
gtag('config', 'UA-153205738-3');
2627
</script>
27-
28-
<!-- Start of Async Drift Code -->
29-
<script>
30-
"use strict";
31-
32-
!function () {
33-
var t = window.driftt = window.drift = window.driftt || [];
34-
if (!t.init) {
35-
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
36-
t.invoked = !0, t.methods = ["identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on"],
37-
t.factory = function (e) {
38-
return function () {
39-
var n = Array.prototype.slice.call(arguments);
40-
return n.unshift(e), t.push(n), t;
41-
};
42-
}, t.methods.forEach(function (e) {
43-
t[e] = t.factory(e);
44-
}), t.load = function (t) {
45-
var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script");
46-
o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js";
47-
var i = document.getElementsByTagName("script")[0];
48-
i.parentNode.insertBefore(o, i);
49-
};
50-
}
51-
}();
52-
drift.SNIPPET_VERSION = '0.3.1';
53-
drift.load('kmcg4ky4chmh');
54-
</script>
55-
<!-- End of Async Drift Code -->
5628
</body>
5729
</html>

public/js/lazy_init.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
!function () {
2+
var t = window.driftt = window.drift = window.driftt || [];
3+
if (!t.init) {
4+
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
5+
t.invoked = !0, t.methods = ["identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on"],
6+
t.factory = function (e) {
7+
return function () {
8+
var n = Array.prototype.slice.call(arguments);
9+
return n.unshift(e), t.push(n), t;
10+
};
11+
}, t.methods.forEach(function (e) {
12+
t[e] = t.factory(e);
13+
}), t.load = function (t) {
14+
var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script");
15+
o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js";
16+
var i = document.getElementsByTagName("script")[0];
17+
i.parentNode.insertBefore(o, i);
18+
};
19+
}
20+
}();
21+
drift.SNIPPET_VERSION = '0.3.1';
22+
drift.load('kmcg4ky4chmh');
23+
24+
window.dataLayer = window.dataLayer || [];
25+
function gtag(){dataLayer.push(arguments);}
26+
gtag('js', new Date());
27+
28+
gtag('config', 'UA-153205738-3');

public/sitemap.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
<url>
99
<loc>https://gitcom.org/</loc>
10-
<lastmod>2019-12-02T01:47:20+00:00</lastmod>
1110
<priority>1.00</priority>
1211
</url>
1312
<url>
14-
<loc>https://gitcom.org/login</loc>
15-
<lastmod>2019-12-02T01:47:20+00:00</lastmod>
16-
<priority>0.80</priority>
13+
<loc>https://gitcom.org/explore/projects</loc>
14+
<priority>0.90</priority>
15+
</url>
16+
<url>
17+
<loc>https://gitcom.org/explore/cards</loc>
18+
<priority>0.90</priority>
1719
</url>
18-
19-
2020
</urlset>

scripts/deploy/prod/copy_build.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/deploy/prod/deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
2-
rm -rf /usr/local/gitcom/frontend/app/build/*
3-
cp -avr /usr/local/gitcom/frontend/app/tmp/build /usr/local/gitcom/frontend/app/
2+
python3 scripts/deploy/prod/stages/cdn_upload.py
3+
./scripts/deploy/prod/stages/copy_build.sh $1
4+
ssh $1 "bash -s" < ./scripts/deploy/prod/stages/deploy.sh
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import os.path, os
2+
from ftplib import FTP, error_perm
3+
4+
from dotenv import load_dotenv
5+
load_dotenv()
6+
7+
load_dotenv(verbose=True)
8+
9+
from pathlib import Path
10+
env_path = Path('.') / '.env'
11+
12+
host = os.getenv("CDN_HOST")
13+
port = 21
14+
15+
ftp = FTP()
16+
ftp.connect(host,port)
17+
ftp.login(os.getenv("CDN_LOGIN"), os.getenv("CDN_PASSWORD"))
18+
19+
def count_files(path):
20+
files_count = 0
21+
for name in os.listdir(path):
22+
localpath = os.path.join(path, name)
23+
if os.path.isfile(localpath):
24+
files_count += 1
25+
elif os.path.isdir(localpath):
26+
files_count += 1
27+
files_count += count_files(localpath)
28+
return files_count
29+
30+
def upload_folder(ftp, path, prefix = None):
31+
if prefix is not None:
32+
progress = 0
33+
print("total files: " + str(count_files(path)) + " in " + path)
34+
root_dir = "/gitcom/" + prefix
35+
try:
36+
ftp.mkd(root_dir)
37+
except error_perm as e:
38+
print(e)
39+
ftp.cwd(root_dir)
40+
41+
for name in os.listdir(path):
42+
localpath = os.path.join(path, name)
43+
if os.path.isfile(localpath):
44+
print("Storing ", name, localpath)
45+
ftp.storbinary('STOR ' + name, open(localpath,'rb'))
46+
elif os.path.isdir(localpath):
47+
print("MKD", name)
48+
49+
try:
50+
ftp.mkd(name)
51+
except error_perm as e:
52+
print(e)
53+
54+
print("CWD", name)
55+
ftp.cwd(name)
56+
upload_folder(ftp, localpath)
57+
print("CWD", "..")
58+
ftp.cwd("..")
59+
60+
upload_folder(ftp, "build", "public/")
61+
62+
ftp.quit()

0 commit comments

Comments
 (0)