Merge branch 'master' into include-subscription-info

This commit is contained in:
Karol Wypchło 2022-03-08 03:58:39 +01:00 committed by GitHub
commit e656bd78a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 86 deletions

View File

@ -3,7 +3,8 @@ include /etc/nginx/conf.d/include/proxy-pass-internal;
include /etc/nginx/conf.d/include/portal-access-check;
# variable definititions - we need to define a variable to be able to access it in lua by ngx.var.something
set $skylink ''; # placeholder for the raw 46 bit skylink
set $skylink ''; # placeholder for the base64 skylink
set $skylink_base32 ''; # placeholder for the base32 skylink
# resolve handshake domain by requesting to /hnsres endpoint and assign correct values to $skylink and $rest
rewrite_by_lua_block {
@ -74,10 +75,16 @@ rewrite_by_lua_block {
if ngx.var.path == "/" and skylink_rest ~= nil and skylink_rest ~= "" and skylink_rest ~= "/" then
ngx.var.path = skylink_rest
end
-- assign base32 skylink to be used in proxy_pass
ngx.var.skylink_base32 = require("skynet.skylink").base32(ngx.var.skylink)
}
# we proxy to another nginx location rather than directly to siad because we do not want to deal with caching here
proxy_pass https://127.0.0.1/$skylink$path$is_args$args;
# host header has to be adjusted to properly match server name
proxy_set_header Host $skylink_base32.$skynet_portal_domain;
# pass the skylink request to subdomain skylink server
proxy_pass $scheme://$server_addr$path$is_args$args;
# in case siad returns location header, we need to replace the skylink with the domain name
header_filter_by_lua_block {

View File

@ -26,17 +26,6 @@ rewrite ^/docs(?:/(.*))?$ https://sdk.skynetlabs.com/$1 permanent;
location / {
include /etc/nginx/conf.d/include/cors;
set $skylink "0404dsjvti046fsua4ktor9grrpe76erq9jot9cvopbhsvsu76r4r30";
set $path $uri;
set $internal_no_limits "true";
include /etc/nginx/conf.d/include/location-skylink;
proxy_intercept_errors on;
error_page 400 404 490 500 502 503 504 =200 @fallback;
}
location @fallback {
proxy_pass http://website:9000;
}
@ -134,15 +123,14 @@ location /abuse/report {
location /hns {
include /etc/nginx/conf.d/include/cors;
# match the request_uri and extract the hns domain and anything that is passed in the uri after it
# example: /hns/something/foo/bar matches:
# > hns_domain: something
# > path: /foo/bar/
set_by_lua_block $hns_domain { return string.match(ngx.var.uri, "/hns/([^/?]+)") }
set_by_lua_block $path { return string.match(ngx.var.uri, "/hns/[^/?]+(.*)") }
rewrite_by_lua_block {
local hns_domain = string.match(ngx.var.uri, "/hns/([^/?]+)")
local path = string.match(ngx.var.uri, "/hns/[^/?]+(.*)")
local args = ngx.var.args and ngx.var.is_args .. ngx.var.args or ""
local hns_subdomain_url = ngx.var.scheme .. "://" .. hns_domain .. ".hns." .. ngx.var.skynet_portal_domain .. path .. args
proxy_set_header Host $host;
include /etc/nginx/conf.d/include/location-hns;
return ngx.redirect(hns_subdomain_url, ngx.HTTP_MOVED_PERMANENTLY)
}
}
location /hnsres {
@ -352,7 +340,8 @@ location ~ "^/(([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?)$" {
rewrite_by_lua_block {
local skynet_skylink = require("skynet.skylink")
local base32_skylink = skynet_skylink.base32(ngx.var.skylink)
local base32_url = ngx.var.scheme .. "://" .. base32_skylink .. "." .. ngx.var.skynet_portal_domain .. ngx.var.path .. ngx.var.is_args .. ngx.var.args
local args = ngx.var.args and ngx.var.is_args .. ngx.var.args or ""
local base32_url = ngx.var.scheme .. "://" .. base32_skylink .. "." .. ngx.var.skynet_portal_domain .. ngx.var.path .. args
return ngx.redirect(base32_url, ngx.HTTP_MOVED_PERMANENTLY)
}

View File

@ -11,7 +11,7 @@
"@fontsource/sora": "4.5.3",
"@fontsource/source-sans-pro": "4.5.3",
"@stripe/react-stripe-js": "1.7.0",
"@stripe/stripe-js": "1.23.0",
"@stripe/stripe-js": "1.24.0",
"classnames": "2.3.1",
"copy-text-to-clipboard": "^3.0.1",
"dayjs": "1.10.8",
@ -19,7 +19,7 @@
"fast-levenshtein": "3.0.0",
"formik": "2.2.9",
"http-status-codes": "2.2.0",
"ky": "0.29.0",
"ky": "0.30.0",
"next": "12.1.0",
"normalize.css": "8.0.1",
"pretty-bytes": "6.0.0",
@ -27,17 +27,17 @@
"react-dom": "17.0.2",
"react-toastify": "8.2.0",
"skynet-js": "3.0.2",
"stripe": "8.205.0",
"stripe": "8.207.0",
"swr": "1.2.2",
"yup": "0.32.11"
},
"devDependencies": {
"@tailwindcss/forms": "0.4.0",
"@tailwindcss/forms": "0.5.0",
"@tailwindcss/typography": "0.5.2",
"autoprefixer": "10.4.2",
"eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"postcss": "8.4.7",
"postcss": "8.4.8",
"prettier": "2.5.1",
"tailwindcss": "3.0.23"
}

View File

@ -177,15 +177,15 @@
dependencies:
prop-types "^15.7.2"
"@stripe/stripe-js@1.23.0":
version "1.23.0"
resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.23.0.tgz#62eed14e83c63c3e8c27f14f6b1e6feb8496c867"
integrity sha512-+7w4rVs71Fk8/8uzyzQB5GotHSH9mjOjxM3EYDq/3MR3I2ewELHtvWVMOqfS/9WSKCaKv7h7eFLsMZGpK5jApQ==
"@stripe/stripe-js@1.24.0":
version "1.24.0"
resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.24.0.tgz#d23977f364565981f8ab30b1b540e367f72abc5c"
integrity sha512-8CEILOpzoRhGwvgcf6y+BlPyEq1ZqxAv3gsX7LvokFYvbcyH72GRcHQMGXuZS3s7HqfYQuTSFrvZNL/qdkgA9Q==
"@tailwindcss/forms@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@tailwindcss/forms/-/forms-0.4.0.tgz#a46715e347a32d216a3973eb67473bd29ae3798e"
integrity sha512-DeaQBx6EgEeuZPQACvC+mKneJsD8am1uiJugjgQK1+/Vt+Ai0GpFBC2T2fqnUad71WgOxyrZPE6BG1VaI6YqfQ==
"@tailwindcss/forms@0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@tailwindcss/forms/-/forms-0.5.0.tgz#d4bea2560a10aac642573e72d3b4d62a88960449"
integrity sha512-KzWugryEBFkmoaYcBE18rs6gthWCFHHO7cAZm2/hv3hwD67AzwP7udSCa22E7R1+CEJL/FfhYsJWrc0b1aeSzw==
dependencies:
mini-svg-data-uri "^1.2.3"
@ -1509,10 +1509,10 @@ jws@^3.2.2:
jwa "^1.4.1"
safe-buffer "^5.0.1"
ky@0.29.0:
version "0.29.0"
resolved "https://registry.yarnpkg.com/ky/-/ky-0.29.0.tgz#292fd7faf7fc25bb9ca977dc1c704607829f52c3"
integrity sha512-01TBSOqlHmLfcQhHseugGHLxPtU03OyZWaLDWt5MfzCkijG6xWFvAQPhKVn0cR2MMjYvBP9keQ8A3+rQEhLO5g==
ky@0.30.0:
version "0.30.0"
resolved "https://registry.yarnpkg.com/ky/-/ky-0.30.0.tgz#a3d293e4f6c4604a9a4694eceb6ce30e73d27d64"
integrity sha512-X/u76z4JtDVq10u1JA5UQfatPxgPaVDMYTrgHyiTpGN2z4TMEJkIHsoSBBSg9SWZEIXTKsi9kHgiQ9o3Y/4yog==
language-subtag-registry@~0.3.2:
version "0.3.21"
@ -1941,10 +1941,10 @@ postcss@8.4.5:
picocolors "^1.0.0"
source-map-js "^1.0.1"
postcss@8.4.7, postcss@^8.4.6:
version "8.4.7"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.7.tgz#f99862069ec4541de386bf57f5660a6c7a0875a8"
integrity sha512-L9Ye3r6hkkCeOETQX6iOaWZgjp3LL6Lpqm6EtgbKrgqGGteRMNb9vzBfRL96YOSu8o7x3MfIH9Mo5cPJFGrW6A==
postcss@8.4.8, postcss@^8.4.6:
version "8.4.8"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.8.tgz#dad963a76e82c081a0657d3a2f3602ce10c2e032"
integrity sha512-2tXEqGxrjvAO6U+CJzDL2Fk2kPHTv1jQsYkSoMeOis2SsYaXRO2COxTdQp99cYvif9JTXaAk9lYGc3VhJt7JPQ==
dependencies:
nanoid "^3.3.1"
picocolors "^1.0.0"
@ -2255,10 +2255,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
stripe@8.205.0:
version "8.205.0"
resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.205.0.tgz#735a70968f8c3d230db55590e7ba27e3b7a91f52"
integrity sha512-hmYnc7je6j0n9GlkUpc8USsUquLzSxmWj78g9NKFokCtSybNy7y9fYS+VB5AuZUwmIkzhTczgf+TaSmI4kbk9A==
stripe@8.207.0:
version "8.207.0"
resolved "https://registry.yarnpkg.com/stripe/-/stripe-8.207.0.tgz#4b7002f19cecefbc3c48f09f6658c39e359f99c1"
integrity sha512-ZCjdqN2adGfrC5uAAo0v7IquzaiQ3+pDzB324/iV3Q3Deiot9VO7KMVSNVx/0i6E6ywhgV33ko3FMT7iUgxKYA==
dependencies:
"@types/node" ">=8.1.0"
qs "^6.6.0"

View File

@ -89,14 +89,6 @@ async function handshakeSubdomainCheck(done) {
return done(await genericAccessCheck("hns_via_subdomain", url));
}
// websiteSkylinkCheck returns the result of accessing siasky.net website through skylink
async function websiteSkylinkCheck(done) {
const websiteSkylink = "AQBG8n_sgEM_nlEp3G0w3vLjmdvSZ46ln8ZXHn-eObZNjA";
const url = await skynetClient.getSkylinkUrl(websiteSkylink, { subdomain: true });
return done(await genericAccessCheck("website_skylink", url));
}
// accountWebsiteCheck returns the result of accessing account dashboard website
async function accountWebsiteCheck(done) {
const url = `https://account.${process.env.PORTAL_DOMAIN}/auth/login`;
@ -228,7 +220,6 @@ const checks = [
skydConfigCheck,
uploadCheck,
websiteCheck,
websiteSkylinkCheck,
downloadCheck,
skylinkSubdomainCheck,
handshakeSubdomainCheck,

View File

@ -13,7 +13,7 @@
"copy-text-to-clipboard": "3.0.1",
"crypto-browserify": "3.12.0",
"framer-motion": "6.2.8",
"gatsby": "4.9.0",
"gatsby": "4.9.2",
"gatsby-background-image": "1.6.0",
"gatsby-plugin-image": "2.9.0",
"gatsby-plugin-manifest": "4.9.0",
@ -34,7 +34,7 @@
"normalize.css": "8.0.1",
"path-browserify": "1.0.1",
"polished": "4.1.4",
"postcss": "8.4.7",
"postcss": "8.4.8",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",

View File

@ -2,9 +2,13 @@ import * as React from "react";
import { LogoWhiteText } from "../Icons";
import Link from "../Link";
const hostname = typeof window !== "undefined" ? window.location.hostname : "";
const domain = hostname.substring(hostname.lastIndexOf(".", hostname.lastIndexOf(".") - 1) + 1);
const emails = domain ? [`hello@${domain}`, `abuse@${domain}`] : [];
// const hostname = typeof window !== "undefined" ? window.location.hostname : "";
// const domain = hostname.substring(hostname.lastIndexOf(".", hostname.lastIndexOf(".") - 1) + 1);
// const emails = domain ? [`hello@${domain}`, `report@${domain}`] : [];
// temporary hardcode siasky.net emails until we have environment
// variables for them and we can reflect that in the terms of service
const emails = ["hello@siasky.net", "report@siasky.net"];
const Footer = () => {
return (

View File

@ -6506,10 +6506,10 @@ gatsby-worker@^1.9.0:
"@babel/core" "^7.15.5"
"@babel/runtime" "^7.15.4"
gatsby@4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-4.9.0.tgz#c3c3d65c7f4350b7a0c3402ef932b44dd7495f78"
integrity sha512-wDCzcCx4hKMqldwuXoG8gQq2nkL7zSqoJXEqWK4nKp8PJKi5DgJxBteKMWOoLPYsaqGZ0ccZmYvp76/zjl2olQ==
gatsby@4.9.2:
version "4.9.2"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-4.9.2.tgz#2a31f8fe8b5007ecfed67b78af27af0587fee817"
integrity sha512-dYUcCLZbyRIuzaswqxSzYFSGs+o1rdJFqZb6AODnq9jsMeDjN2jRC4DieDLzrWwDJCerW3rupDrHWsNfDj68Mw==
dependencies:
"@babel/code-frame" "^7.14.0"
"@babel/core" "^7.15.5"
@ -6606,7 +6606,7 @@ gatsby@4.9.0:
joi "^17.4.2"
json-loader "^0.5.7"
latest-version "5.1.0"
lmdb "2.2.1"
lmdb "^2.2.3"
lodash "^4.17.21"
md5-file "^5.0.0"
meant "^1.0.3"
@ -8107,21 +8107,10 @@ listr2@^3.8.3:
through "^2.3.8"
wrap-ansi "^7.0.0"
lmdb@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/lmdb/-/lmdb-2.2.1.tgz#b7fd22ed2268ab74aa71108b793678314a7b94bb"
integrity sha512-tUlIjyJvbd4mqdotI9Xe+3PZt/jqPx70VKFDrKMYu09MtBWOT3y2PbuTajX+bJFDjbgLkQC0cTx2n6dithp/zQ==
dependencies:
msgpackr "^1.5.4"
nan "^2.14.2"
node-gyp-build "^4.2.3"
ordered-binary "^1.2.4"
weak-lru-cache "^1.2.2"
lmdb@^2.0.2, lmdb@^2.1.7:
version "2.2.3"
resolved "https://registry.yarnpkg.com/lmdb/-/lmdb-2.2.3.tgz#713ffa515c31e042808abf364b4aa0feaeaf6360"
integrity sha512-+OiHQpw22mBBxocb/9vcVNETqf0k5vgHA2r+KX7eCf8j5tSV50ZIv388iY1mnnrERIUhs2sjKQbZhPg7z4HyPQ==
lmdb@^2.0.2, lmdb@^2.1.7, lmdb@^2.2.3:
version "2.2.4"
resolved "https://registry.yarnpkg.com/lmdb/-/lmdb-2.2.4.tgz#6494d5a1d1db152e0be759edcfa06893e4cbdb53"
integrity sha512-gto+BB2uEob8qRiTlOq+R3uX0YNHsX9mjxj9Sbdue/LIKqu6IlZjrsjKeGyOMquc/474GEqFyX2pdytpydp0rQ==
dependencies:
msgpackr "^1.5.4"
nan "^2.14.2"
@ -9884,10 +9873,10 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==
postcss@8.4.7, postcss@^8.2.15, postcss@^8.2.9, postcss@^8.3.11, postcss@^8.4.6:
version "8.4.7"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.7.tgz#f99862069ec4541de386bf57f5660a6c7a0875a8"
integrity sha512-L9Ye3r6hkkCeOETQX6iOaWZgjp3LL6Lpqm6EtgbKrgqGGteRMNb9vzBfRL96YOSu8o7x3MfIH9Mo5cPJFGrW6A==
postcss@8.4.8, postcss@^8.2.15, postcss@^8.2.9, postcss@^8.3.11, postcss@^8.4.6:
version "8.4.8"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.8.tgz#dad963a76e82c081a0657d3a2f3602ce10c2e032"
integrity sha512-2tXEqGxrjvAO6U+CJzDL2Fk2kPHTv1jQsYkSoMeOis2SsYaXRO2COxTdQp99cYvif9JTXaAk9lYGc3VhJt7JPQ==
dependencies:
nanoid "^3.3.1"
picocolors "^1.0.0"