Merge branch 'master' into dashboard-v2-profile-page

This commit is contained in:
Karol Wypchło 2022-03-17 10:34:37 +01:00 committed by GitHub
commit 9f92e3a617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 96 additions and 367 deletions

View File

@ -64,8 +64,6 @@ services:
logging: *default-logging logging: *default-logging
env_file: env_file:
- .env - .env
environment:
- SKYD_DISK_CACHE_ENABLED=${SKYD_DISK_CACHE_ENABLED:-true}
volumes: volumes:
- ./docker/data/nginx/cache:/data/nginx/cache - ./docker/data/nginx/cache:/data/nginx/cache
- ./docker/data/nginx/blocker:/data/nginx/blocker - ./docker/data/nginx/blocker:/data/nginx/blocker

View File

@ -2,4 +2,4 @@ more_set_headers 'Access-Control-Allow-Origin: $http_origin';
more_set_headers 'Access-Control-Allow-Credentials: true'; more_set_headers 'Access-Control-Allow-Credentials: true';
more_set_headers 'Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE'; more_set_headers 'Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE';
more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,If-None-Match,Cache-Control,Content-Type,Range,X-HTTP-Method-Override,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,upload-concat,location,Skynet-API-Key'; more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,If-None-Match,Cache-Control,Content-Type,Range,X-HTTP-Method-Override,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,upload-concat,location,Skynet-API-Key';
more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,ETag,Skynet-File-Metadata,Skynet-Skylink,Skynet-Proof,Skynet-Portal-Api,Skynet-Server-Api,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,upload-concat,location'; more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range,ETag,Accept-Ranges,Skynet-File-Metadata,Skynet-Skylink,Skynet-Proof,Skynet-Portal-Api,Skynet-Server-Api,upload-offset,upload-metadata,upload-length,tus-version,tus-resumable,tus-extension,tus-max-size,upload-concat,location';

View File

@ -1,6 +1,5 @@
include /etc/nginx/conf.d/include/cors; include /etc/nginx/conf.d/include/cors;
include /etc/nginx/conf.d/include/proxy-buffer; include /etc/nginx/conf.d/include/proxy-buffer;
include /etc/nginx/conf.d/include/proxy-cache-downloads;
include /etc/nginx/conf.d/include/track-download; include /etc/nginx/conf.d/include/track-download;
limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
@ -9,62 +8,10 @@ limit_conn downloads_by_ip 100; # ddos protection: max 100 downloads at a time
# this is important because we want only one format in cache keys and logs # this is important because we want only one format in cache keys and logs
set_by_lua_block $skylink { return require("skynet.skylink").parse(ngx.var.skylink) } set_by_lua_block $skylink { return require("skynet.skylink").parse(ngx.var.skylink) }
# $skylink_v1 and $skylink_v2 variables default to the same value but in case the requested skylink was:
# a) skylink v1 - it would not matter, no additional logic is executed
# b) skylink v2 - in a lua block below we will resolve the skylink v2 into skylink v1 and update
# $skylink_v1 variable so then the proxy request to skyd can be cached in nginx (proxy_cache_key
# in proxy-cache-downloads includes $skylink_v1 as a part of the cache key)
set $skylink_v1 $skylink;
set $skylink_v2 $skylink;
# variable for Skynet-Proof header that we need to inject
# into a response if the request was for skylink v2
set $skynet_proof '';
# default download rate to unlimited # default download rate to unlimited
set $limit_rate 0; set $limit_rate 0;
access_by_lua_block { access_by_lua_block {
-- the block below only makes sense if we are using nginx cache
if not ngx.var.skyd_disk_cache_enabled then
local httpc = require("resty.http").new()
-- detect whether requested skylink is v2
local isBase32v2 = string.len(ngx.var.skylink) == 55 and string.sub(ngx.var.skylink, 0, 2) == "04"
local isBase64v2 = string.len(ngx.var.skylink) == 46 and string.sub(ngx.var.skylink, 0, 2) == "AQ"
if isBase32v2 or isBase64v2 then
-- 10.10.10.10 points to sia service (alias not available when using resty-http)
local res, err = httpc:request_uri("http://10.10.10.10:9980/skynet/resolve/" .. ngx.var.skylink_v2, {
headers = { ["User-Agent"] = "Sia-Agent" }
})
-- print error and exit with 500 or exit with response if status is not 200
if err or (res and res.status ~= ngx.HTTP_OK) then
ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status
ngx.header["content-type"] = "text/plain"
ngx.say(err or res.body)
return ngx.exit(ngx.status)
end
local json = require('cjson')
local resolve = json.decode(res.body)
ngx.var.skylink_v1 = resolve.skylink
ngx.var.skynet_proof = res.headers["Skynet-Proof"]
end
-- check if skylink v1 is present on blocklist (compare hashes)
if require("skynet.blocklist").is_blocked(ngx.var.skylink_v1) then
return require("skynet.blocklist").exit_illegal()
end
-- if skylink is found on nocache list then set internal nocache variable
-- to tell nginx that it should not try and cache this file (too large)
if ngx.shared.nocache:get(ngx.var.skylink_v1) then
ngx.var.nocache = "1"
end
end
if require("skynet.account").accounts_enabled() then if require("skynet.account").accounts_enabled() then
-- check if portal is in authenticated only mode -- check if portal is in authenticated only mode
if require("skynet.account").is_access_unauthorized() then if require("skynet.account").is_access_unauthorized() then
@ -84,36 +31,10 @@ access_by_lua_block {
end end
} }
header_filter_by_lua_block {
ngx.header["Skynet-Portal-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_portal_domain
ngx.header["Skynet-Server-Api"] = ngx.var.scheme .. "://" .. ngx.var.skynet_server_domain
-- the block below only makes sense if we are using nginx cache
if not ngx.var.skyd_disk_cache_enabled then
-- not empty skynet_proof means this is a skylink v2 request
-- so we should replace the Skynet-Proof header with the one
-- we got from /skynet/resolve/ endpoint, otherwise we would
-- be serving cached empty v1 skylink Skynet-Proof header
if ngx.var.skynet_proof and ngx.var.skynet_proof ~= "" then
ngx.header["Skynet-Proof"] = ngx.var.skynet_proof
end
-- add skylink to nocache list if it exceeds 1GB (1e+9 bytes) threshold
-- (content length can be nil for already cached files - we can ignore them)
if ngx.header["Content-Length"] and tonumber(ngx.header["Content-Length"]) > 1e+9 then
ngx.shared.nocache:set(ngx.var.skylink_v1, ngx.header["Content-Length"])
end
end
}
limit_rate_after 512k; limit_rate_after 512k;
limit_rate $limit_rate; limit_rate $limit_rate;
proxy_read_timeout 600; proxy_read_timeout 600;
proxy_set_header User-Agent: Sia-Agent; proxy_set_header User-Agent: Sia-Agent;
# in case the requested skylink was v2 and we already resolved it to skylink v1, we are going to pass resolved proxy_pass http://sia:9980/skynet/skylink/$skylink$path$is_args$args;
# skylink v1 to skyd to save that extra skylink v2 lookup in skyd but in turn, in case skyd returns a redirect
# we need to rewrite the skylink v1 to skylink v2 in the location header with proxy_redirect
proxy_redirect $skylink_v1 $skylink_v2;
proxy_pass http://sia:9980/skynet/skylink/$skylink_v1$path$is_args$args;

View File

@ -1,21 +0,0 @@
proxy_cache skynet; # cache name
proxy_cache_key $skylink_v1$path$arg_format$arg_attachment$arg_start$arg_end$http_range; # unique cache key
proxy_cache_min_uses 3; # cache after 3 uses
proxy_cache_valid 200 206 307 308 48h; # keep 200, 206, 307 and 308 responses valid for up to 2 days
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
# map skyd env variable value to "1" for true and "0" for false (expected by proxy_no_cache)
set_by_lua_block $skyd_disk_cache_enabled {
return os.getenv("SKYD_DISK_CACHE_ENABLED") == "true" and "1" or "0"
}
# bypass - this will bypass cache hit on request (status BYPASS)
# but still stores file in cache if cache conditions are met
proxy_cache_bypass $cookie_nocache $arg_nocache $skyd_disk_cache_enabled;
# no cache - this will ignore cache on request (status MISS)
# and does not store file in cache under no condition
set_if_empty $nocache "0";
# disable cache when nocache is set or skyd cache is enabled
proxy_no_cache $nocache $skyd_disk_cache_enabled;

View File

@ -1,9 +0,0 @@
server {
# local server - do not expose this port externally
listen 8000;
# secure traffic by limiting to only local networks
include /etc/nginx/conf.d/include/local-network-only;
include /etc/nginx/conf.d/server/server.local;
}

View File

@ -38,8 +38,6 @@ location / {
end end
ngx.var.skylink = require("skynet.skylink").parse(ngx.var.skylink) ngx.var.skylink = require("skynet.skylink").parse(ngx.var.skylink)
ngx.var.skylink_v1 = ngx.var.skylink
ngx.var.skylink_v2 = ngx.var.skylink
} }
include /etc/nginx/conf.d/include/location-skylink; include /etc/nginx/conf.d/include/location-skylink;

View File

@ -1,37 +0,0 @@
include /etc/nginx/conf.d/include/init-optional-variables;
location /skynet/blocklist {
client_max_body_size 10m; # increase max body size to account for large lists
client_body_buffer_size 10m; # force whole body to memory so we can read it
content_by_lua_block {
local httpc = require("resty.http").new()
ngx.req.read_body() -- ensure the post body data is read before using get_body_data
-- proxy blocklist update request
-- 10.10.10.10 points to sia service (alias not available when using resty-http)
local res, err = httpc:request_uri("http://10.10.10.10:9980/skynet/blocklist", {
method = "POST",
body = ngx.req.get_body_data(),
headers = {
["Content-Type"] = "application/x-www-form-urlencoded",
["Authorization"] = require("skynet.utils").authorization_header(),
["User-Agent"] = "Sia-Agent",
}
})
-- print error and exit with 500 or exit with response if status is not 204
if err or (res and res.status ~= ngx.HTTP_NO_CONTENT) then
ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status
ngx.header["content-type"] = "text/plain"
ngx.say(err or res.body)
return ngx.exit(ngx.status)
end
require("skynet.blocklist").reload()
ngx.status = ngx.HTTP_NO_CONTENT
return ngx.exit(ngx.status)
}
}

View File

@ -1,66 +0,0 @@
local _M = {}
function _M.reload()
local httpc = require("resty.http").new()
-- fetch blocklist records (all blocked skylink hashes)
-- 10.10.10.10 points to sia service (alias not available when using resty-http)
local res, err = httpc:request_uri("http://10.10.10.10:9980/skynet/blocklist", {
headers = {
["User-Agent"] = "Sia-Agent",
}
})
-- fail whole request in case this request failed, we want to make sure
-- the blocklist is pre cached before serving first skylink
if err or (res and res.status ~= ngx.HTTP_OK) then
ngx.log(ngx.ERR, "Failed skyd service request /skynet/blocklist: ", err or ("[HTTP " .. res.status .. "] " .. res.body))
ngx.status = (err and ngx.HTTP_INTERNAL_SERVER_ERROR) or res.status
ngx.header["content-type"] = "text/plain"
ngx.say(err or res.body)
return ngx.exit(ngx.status)
elseif res and res.status == ngx.HTTP_OK then
local json = require('cjson')
local data = json.decode(res.body)
-- mark all existing entries as expired
ngx.shared.blocklist:flush_all()
-- check if blocklist is table (it is null when empty)
if type(data.blocklist) == "table" then
-- set all cache entries one by one (resets expiration)
for i, hash in ipairs(data.blocklist) do
ngx.shared.blocklist:set(hash, true)
end
end
-- ensure that init flag is persisted
ngx.shared.blocklist:set("__init", true)
-- remove all leftover expired entries
ngx.shared.blocklist:flush_expired()
end
end
function _M.is_blocked(skylink)
-- make sure that blocklist has been preloaded
if not ngx.shared.blocklist:get("__init") then _M.reload() end
-- hash skylink before comparing it with blocklist
local hash = require("skynet.skylink").hash(skylink)
-- we need to use get_stale because we are expiring previous
-- entries when the blocklist is reloading and we still want
-- to block them until the reloading is finished
return ngx.shared.blocklist:get_stale(hash) == true
end
-- exit with 416 illegal content status code
function _M.exit_illegal()
ngx.status = ngx.HTTP_ILLEGAL
ngx.header["content-type"] = "text/plain"
ngx.say("Unavailable For Legal Reasons")
return ngx.exit(ngx.status)
end
return _M

View File

@ -31,7 +31,6 @@ env SERVER_DOMAIN;
env PORTAL_MODULES; env PORTAL_MODULES;
env ACCOUNTS_LIMIT_ACCESS; env ACCOUNTS_LIMIT_ACCESS;
env SIA_API_PASSWORD; env SIA_API_PASSWORD;
env SKYD_DISK_CACHE_ENABLED;
events { events {
worker_connections 8192; worker_connections 8192;
@ -75,20 +74,10 @@ http {
# proxy cache definition # proxy cache definition
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=skynet:10m max_size=50g min_free=100g inactive=48h use_temp_path=off; proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=skynet:10m max_size=50g min_free=100g inactive=48h use_temp_path=off;
# create a shared blocklist dictionary with size of 30 megabytes
# estimated capacity of 1 megabyte dictionary is 3500 blocklist entries
# that gives us capacity of around 100k entries in 30 megabyte dictionary
lua_shared_dict blocklist 30m;
# create a shared dictionary to fill with skylinks that should not
# be cached due to the large size or some other reasons
lua_shared_dict nocache 10m;
# this runs before forking out nginx worker processes # this runs before forking out nginx worker processes
init_by_lua_block { init_by_lua_block {
require "cjson" require "cjson"
require "resty.http" require "resty.http"
require "skynet.blocklist"
require "skynet.skylink" require "skynet.skylink"
require "skynet.utils" require "skynet.utils"
} }

View File

@ -6,24 +6,24 @@
"author": "Skynet Labs.", "author": "Skynet Labs.",
"dependencies": { "dependencies": {
"@fontsource/sora": "4.5.3", "@fontsource/sora": "4.5.3",
"@fontsource/source-sans-pro": "4.5.3", "@fontsource/source-sans-pro": "4.5.4",
"@svgr/webpack": "6.2.1", "@svgr/webpack": "6.2.1",
"bytes": "3.1.2", "bytes": "3.1.2",
"classnames": "2.3.1", "classnames": "2.3.1",
"copy-text-to-clipboard": "3.0.1", "copy-text-to-clipboard": "3.0.1",
"crypto-browserify": "3.12.0", "crypto-browserify": "3.12.0",
"framer-motion": "6.2.8", "framer-motion": "6.2.8",
"gatsby": "4.9.2", "gatsby": "4.9.3",
"gatsby-background-image": "1.6.0", "gatsby-background-image": "1.6.0",
"gatsby-plugin-image": "2.9.0", "gatsby-plugin-image": "2.9.0",
"gatsby-plugin-manifest": "4.9.1", "gatsby-plugin-manifest": "4.9.1",
"gatsby-plugin-postcss": "5.9.0", "gatsby-plugin-postcss": "5.9.0",
"gatsby-plugin-react-helmet": "5.9.0", "gatsby-plugin-react-helmet": "5.9.0",
"gatsby-plugin-robots-txt": "1.7.0", "gatsby-plugin-robots-txt": "1.7.0",
"gatsby-plugin-sharp": "4.9.0", "gatsby-plugin-sharp": "4.9.1",
"gatsby-plugin-sitemap": "5.9.0", "gatsby-plugin-sitemap": "5.9.0",
"gatsby-plugin-svgr": "3.0.0-beta.0", "gatsby-plugin-svgr": "3.0.0-beta.0",
"gatsby-source-filesystem": "4.9.0", "gatsby-source-filesystem": "4.9.1",
"gatsby-transformer-sharp": "4.9.0", "gatsby-transformer-sharp": "4.9.0",
"gatsby-transformer-yaml": "4.9.0", "gatsby-transformer-yaml": "4.9.0",
"gbimage-bridge": "0.2.1", "gbimage-bridge": "0.2.1",

View File

@ -1103,10 +1103,10 @@
resolved "https://registry.yarnpkg.com/@fontsource/sora/-/sora-4.5.3.tgz#987c9b43acb00c9e3fa5377ebcedfd4ec9b760a7" resolved "https://registry.yarnpkg.com/@fontsource/sora/-/sora-4.5.3.tgz#987c9b43acb00c9e3fa5377ebcedfd4ec9b760a7"
integrity sha512-0ipYkroLonvChAyLajgIt6mImXMhvjrHwD5g7iX2ZR1eJ4hLDnwq6haW5pSeehe79lPjgp0BX6ZHivFIP0xR2g== integrity sha512-0ipYkroLonvChAyLajgIt6mImXMhvjrHwD5g7iX2ZR1eJ4hLDnwq6haW5pSeehe79lPjgp0BX6ZHivFIP0xR2g==
"@fontsource/source-sans-pro@4.5.3": "@fontsource/source-sans-pro@4.5.4":
version "4.5.3" version "4.5.4"
resolved "https://registry.yarnpkg.com/@fontsource/source-sans-pro/-/source-sans-pro-4.5.3.tgz#bdb1eeed5db70bcd1f68cd1e8c859834f0e6bc67" resolved "https://registry.yarnpkg.com/@fontsource/source-sans-pro/-/source-sans-pro-4.5.4.tgz#51510723ff40f446c7800f133e9ae604ae2f38d7"
integrity sha512-9xWGu3ArKsjf6+WVrNoCUywybTB3rIidpvOI2tByQpzYVOupFUv6qohyrjDrVvPb6XHJQTD0NIzisR7RKhiP7A== integrity sha512-+YYw6HRvH9wYE+U2Hvxyossg+MHPApAj7VIjEqaXenNeNQa4U3uPD0e7pc+1Gic3srCQATN15O3S9WSFLXTmwQ==
"@gatsbyjs/parcel-namer-relative-to-cwd@0.0.2": "@gatsbyjs/parcel-namer-relative-to-cwd@0.0.2":
version "0.0.2" version "0.0.2"
@ -3319,23 +3319,23 @@ babel-plugin-polyfill-regenerator@^0.3.0:
dependencies: dependencies:
"@babel/helper-define-polyfill-provider" "^0.3.1" "@babel/helper-define-polyfill-provider" "^0.3.1"
babel-plugin-remove-graphql-queries@^4.9.0: babel-plugin-remove-graphql-queries@^4.9.0, babel-plugin-remove-graphql-queries@^4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-4.9.0.tgz#5804094466f12670e3e43434addb80a3561d96d6" resolved "https://registry.yarnpkg.com/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-4.9.1.tgz#75290c6dd840d28343dc47f9517a634e02255b80"
integrity sha512-q3xS5KDPoxujHrNWbilChE0Q+riCdxmvUseZbSzaikfY+KV9z3nCzaGkuEHxU2xVVa+8K5Nvu9zKlf/KtQfxXw== integrity sha512-Mg+NB34cjdV6rIGIahMe0qij3KpWf7M8NFe8J1w2kxjQty4mpGX2qqmMUHhwxqwVWAhH1LZeiqitFZ6D/+CbJg==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
babel-plugin-transform-react-remove-prop-types@^0.4.24: babel-plugin-transform-react-remove-prop-types@^0.4.24:
version "0.4.24" version "0.4.24"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a"
integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==
babel-preset-gatsby@^2.9.0: babel-preset-gatsby@^2.9.1:
version "2.9.0" version "2.9.1"
resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.9.0.tgz#6a478ee39b99be21b5ed804ebd8cc96a0fd492d3" resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.9.1.tgz#2f62f7f7899ed7282f0a84ef0b5a0e131225ed96"
integrity sha512-naGwVr1uCX2NsyM38pTp0f+vO0UfCH2h7wEC1H8B748twHTUpoOPJ/GWUs+/FQzNrfgOvHSspcqkRyD3Vb2EPg== integrity sha512-HkZyo5Phb5+vbICx0Q8Goj+FV8xPH4detCqJUDHH9sfBvAjvdnKfL2dtDFd0QvKhUQ/55rO3Rdcmo6PU5zYwZw==
dependencies: dependencies:
"@babel/plugin-proposal-class-properties" "^7.14.0" "@babel/plugin-proposal-class-properties" "^7.14.0"
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5"
@ -3350,7 +3350,7 @@ babel-preset-gatsby@^2.9.0:
babel-plugin-dynamic-import-node "^2.3.3" babel-plugin-dynamic-import-node "^2.3.3"
babel-plugin-macros "^2.8.0" babel-plugin-macros "^2.8.0"
babel-plugin-transform-react-remove-prop-types "^0.4.24" babel-plugin-transform-react-remove-prop-types "^0.4.24"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
gatsby-legacy-polyfills "^2.9.0" gatsby-legacy-polyfills "^2.9.0"
backo2@^1.0.2, backo2@~1.0.2: backo2@^1.0.2, backo2@~1.0.2:
@ -6147,10 +6147,10 @@ gatsby-background-image@1.6.0:
short-uuid "^4.2.0" short-uuid "^4.2.0"
sort-media-queries "^0.2.2" sort-media-queries "^0.2.2"
gatsby-cli@^4.9.0: gatsby-cli@^4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-cli/-/gatsby-cli-4.9.0.tgz#3c6c9a26252671eb60abd399abdaca37836ab2a1" resolved "https://registry.yarnpkg.com/gatsby-cli/-/gatsby-cli-4.9.1.tgz#abe57cc656329deb69aef3d75b5cb14f36473d8e"
integrity sha512-e4pQ+7Z+9Cppql59fy0OOo2El+ERkzOCVW2+ev5CojiljDb4x/nUHIx9ahKhgA5136F0DaCZ6w/lrOWJmi3ZSQ== integrity sha512-iU5pmwAq5d1XXo98BkYe2KccH3Dy/jsj7QsvP0CpfzOO0EFtidg5KUzPPaekLaGyoqxiMwWf0uAX7S1ERzMFYw==
dependencies: dependencies:
"@babel/code-frame" "^7.14.0" "@babel/code-frame" "^7.14.0"
"@babel/core" "^7.15.5" "@babel/core" "^7.15.5"
@ -6172,8 +6172,8 @@ gatsby-cli@^4.9.0:
execa "^5.1.1" execa "^5.1.1"
fs-exists-cached "^1.0.0" fs-exists-cached "^1.0.0"
fs-extra "^10.0.0" fs-extra "^10.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
gatsby-telemetry "^3.9.0" gatsby-telemetry "^3.9.1"
hosted-git-info "^3.0.8" hosted-git-info "^3.0.8"
is-valid-path "^0.1.1" is-valid-path "^0.1.1"
joi "^17.4.2" joi "^17.4.2"
@ -6233,26 +6233,26 @@ gatsby-legacy-polyfills@^2.9.0:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
core-js-compat "3.9.0" core-js-compat "3.9.0"
gatsby-link@^4.9.0: gatsby-link@^4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-4.9.0.tgz#3aac564fbc406d550d8654ffad116f200f34a9c1" resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-4.9.1.tgz#af444bd3a28e90816a1291f85b70de920c302f1d"
integrity sha512-5QiqDQo16b8VwEx4mRkAnPhAt+fyWOTT+sz2AkG7enR7psoQ7fg9Ndck0CHfME9aLQFm/2GLw8JwD1OGyARPRw== integrity sha512-c5YbR43fESNKlScS+ciJaLjuJuFruoL1my9z6k0ZbMIJUI7z6qH+XIVteH00Kbryz0fejNDaGWeAr3gvEyDlSA==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
"@types/reach__router" "^1.3.10" "@types/reach__router" "^1.3.10"
gatsby-page-utils "^2.9.0" gatsby-page-utils "^2.9.1"
prop-types "^15.7.2" prop-types "^15.7.2"
gatsby-page-utils@^2.9.0: gatsby-page-utils@^2.9.1:
version "2.9.0" version "2.9.1"
resolved "https://registry.yarnpkg.com/gatsby-page-utils/-/gatsby-page-utils-2.9.0.tgz#ec836db457eed98bc3a46fef3aba8c3d9ecd1c29" resolved "https://registry.yarnpkg.com/gatsby-page-utils/-/gatsby-page-utils-2.9.1.tgz#4da1fd5bb21623334868a9b77976755364ad03ed"
integrity sha512-/WaS9FJismKPZfRsS2vIhVAd/1eGRe9+dmFZS7Rp6OUPGrELlen3V8h6msE2BpbkmaTf4eQbKgFdrTBkykkAyw== integrity sha512-Otgwt30usTa94pWF3915+w/6uCPJIQHSVEAF8BD9iBl2mCBCZIS0+rCrVNm9lBrg+tc3JuezvIQsSycwaWnO5Q==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
bluebird "^3.7.2" bluebird "^3.7.2"
chokidar "^3.5.2" chokidar "^3.5.2"
fs-exists-cached "^1.0.0" fs-exists-cached "^1.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
glob "^7.2.0" glob "^7.2.0"
lodash "^4.17.21" lodash "^4.17.21"
micromatch "^4.0.4" micromatch "^4.0.4"
@ -6310,20 +6310,20 @@ gatsby-plugin-manifest@4.9.1:
semver "^7.3.5" semver "^7.3.5"
sharp "^0.30.1" sharp "^0.30.1"
gatsby-plugin-page-creator@^4.9.0: gatsby-plugin-page-creator@^4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-4.9.0.tgz#b0ddff77698f2d33f4789e0396e7788a2930fd70" resolved "https://registry.yarnpkg.com/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-4.9.1.tgz#d73b6af0d26a19a25ddece1ea2276149f0ee2c44"
integrity sha512-eryfrvg/d2L4oL6VR6FHQKX1gkRuVkqHe6gTLRBBk4B2+2x5UoxxSOSSxXlsTByFW0K3vyzD2nPpdeE08ArvEQ== integrity sha512-06EA9nd+LxZxtxTsr6G8xYuaMCDZN2z0qEHX8TvQXcgFVktFB18nUISjfeMBTdiyM1zeVxMCWffBarbUG6IMGA==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
"@babel/traverse" "^7.15.4" "@babel/traverse" "^7.15.4"
"@sindresorhus/slugify" "^1.1.2" "@sindresorhus/slugify" "^1.1.2"
chokidar "^3.5.2" chokidar "^3.5.2"
fs-exists-cached "^1.0.0" fs-exists-cached "^1.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
gatsby-page-utils "^2.9.0" gatsby-page-utils "^2.9.1"
gatsby-plugin-utils "^3.3.0" gatsby-plugin-utils "^3.3.0"
gatsby-telemetry "^3.9.0" gatsby-telemetry "^3.9.1"
globby "^11.0.4" globby "^11.0.4"
lodash "^4.17.21" lodash "^4.17.21"
@ -6350,10 +6350,10 @@ gatsby-plugin-robots-txt@1.7.0:
"@babel/runtime" "^7.16.7" "@babel/runtime" "^7.16.7"
generate-robotstxt "^8.0.3" generate-robotstxt "^8.0.3"
gatsby-plugin-sharp@4.9.0: gatsby-plugin-sharp@4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-4.9.0.tgz#c1370d00d55e025d2e5d1d9b3017865ea9d890c7" resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-4.9.1.tgz#44667f134be1855fe666ed58839bd280527337bd"
integrity sha512-65JcqL11kyecTDYl3uZ/SvBI2FRJgSC7JTxzoV1ZOJkNQpn4nRLRUFL5UTijnnwU9+tba3i6gxKtZEAlE94pcA== integrity sha512-oHnuxIok0Ct3nktn53XQFX36QXwa4H9hjj5lkxaY3zh0giYJmFAsHyvus6DKzGQ14cTC3AkvaD+rqv4SGdjRcg==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
async "^3.2.3" async "^3.2.3"
@ -6361,9 +6361,9 @@ gatsby-plugin-sharp@4.9.0:
debug "^4.3.3" debug "^4.3.3"
filenamify "^4.3.0" filenamify "^4.3.0"
fs-extra "^10.0.0" fs-extra "^10.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
gatsby-plugin-utils "^3.3.0" gatsby-plugin-utils "^3.3.0"
gatsby-telemetry "^3.9.0" gatsby-telemetry "^3.9.1"
got "^11.8.3" got "^11.8.3"
lodash "^4.17.21" lodash "^4.17.21"
mini-svg-data-uri "^1.4.3" mini-svg-data-uri "^1.4.3"
@ -6390,10 +6390,10 @@ gatsby-plugin-svgr@3.0.0-beta.0:
resolved "https://registry.yarnpkg.com/gatsby-plugin-svgr/-/gatsby-plugin-svgr-3.0.0-beta.0.tgz#7e5315f51dae2663a447899322ea1487cef93dd6" resolved "https://registry.yarnpkg.com/gatsby-plugin-svgr/-/gatsby-plugin-svgr-3.0.0-beta.0.tgz#7e5315f51dae2663a447899322ea1487cef93dd6"
integrity sha512-oALTh6VwO6l3khgC/vGr706aqt38EkXwdr6iXVei/auOKGxpCLEuDCQVal1a4SpYXdjHjRsEyab6bxaHL2lzsA== integrity sha512-oALTh6VwO6l3khgC/vGr706aqt38EkXwdr6iXVei/auOKGxpCLEuDCQVal1a4SpYXdjHjRsEyab6bxaHL2lzsA==
gatsby-plugin-typescript@^4.9.0: gatsby-plugin-typescript@^4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-typescript/-/gatsby-plugin-typescript-4.9.0.tgz#e81031863b72c4471292759923325761a1e23c3a" resolved "https://registry.yarnpkg.com/gatsby-plugin-typescript/-/gatsby-plugin-typescript-4.9.1.tgz#343f0cb6c4e72115875c264c127b293f8e1915a5"
integrity sha512-kY1kV5zGaPRbRAyHtbpPhxg/aW+6wqNhe6kA+H6EWCE+JcNZkKojyoIe+tKq3+ddq4ZE7BEDXU97N6t4WJFBvg== integrity sha512-VYkosDqk4CLDz11snEdSIBSW/RAPi8eXD4fHyicuFx5dh11BGi7TMUzVVmwvYWHHleQdvboC4qYlDrzXXV++zw==
dependencies: dependencies:
"@babel/core" "^7.15.5" "@babel/core" "^7.15.5"
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5"
@ -6401,7 +6401,7 @@ gatsby-plugin-typescript@^4.9.0:
"@babel/plugin-proposal-optional-chaining" "^7.14.5" "@babel/plugin-proposal-optional-chaining" "^7.14.5"
"@babel/preset-typescript" "^7.15.0" "@babel/preset-typescript" "^7.15.0"
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
babel-plugin-remove-graphql-queries "^4.9.0" babel-plugin-remove-graphql-queries "^4.9.1"
gatsby-plugin-utils@^3.3.0: gatsby-plugin-utils@^3.3.0:
version "3.3.0" version "3.3.0"
@ -6427,16 +6427,16 @@ gatsby-sharp@^0.3.0:
"@types/sharp" "^0.29.5" "@types/sharp" "^0.29.5"
sharp "^0.30.1" sharp "^0.30.1"
gatsby-source-filesystem@4.9.0: gatsby-source-filesystem@4.9.1:
version "4.9.0" version "4.9.1"
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-4.9.0.tgz#8cf6f3f67cc97f8a75e284814f444a0eea3263e6" resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-4.9.1.tgz#e619d8a482b0477c28225ffce9c28cbb0606ce67"
integrity sha512-woSxEgYeZSVZSpxm+FwB+RjRIyhcix1AR9766W4yk5RwYH2wciF2OfxRC73WW/o/v1ztzeW6RoqIIY+GBXaA1A== integrity sha512-2HS9+5i+F7tRgxBiv8Op9xK/jvd5DGUfedFsJ6/6sfoXUBddowvW4rVEj4XO42TsIQJe7eVj7FfzfqzSqQN8ow==
dependencies: dependencies:
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
chokidar "^3.5.2" chokidar "^3.5.2"
file-type "^16.5.3" file-type "^16.5.3"
fs-extra "^10.0.0" fs-extra "^10.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
got "^9.6.0" got "^9.6.0"
md5-file "^5.0.0" md5-file "^5.0.0"
mime "^2.5.2" mime "^2.5.2"
@ -6445,10 +6445,10 @@ gatsby-source-filesystem@4.9.0:
valid-url "^1.0.9" valid-url "^1.0.9"
xstate "^4.26.1" xstate "^4.26.1"
gatsby-telemetry@^3.9.0: gatsby-telemetry@^3.9.0, gatsby-telemetry@^3.9.1:
version "3.9.0" version "3.9.1"
resolved "https://registry.yarnpkg.com/gatsby-telemetry/-/gatsby-telemetry-3.9.0.tgz#d438841a6351ab1fd02c71244cdf78350694f070" resolved "https://registry.yarnpkg.com/gatsby-telemetry/-/gatsby-telemetry-3.9.1.tgz#3c20c7e0cb363ccaae41fb581ab289330b5d7f69"
integrity sha512-ifqJ4KS16mbpfZ5oVaU4WEbk6gccivVqjCbzfVGgqtl+C8B0u1CeShvr4NcJE1FdVFYIOB4uJeV9Wym03B075A== integrity sha512-ChXTshfvo5njd/u6kSZErDUvc/uSmtOEuo7wrt/68Xjz2JVG6nsLlRxaZpx0DxnDAInouItMVX0VF40RAU7qKg==
dependencies: dependencies:
"@babel/code-frame" "^7.14.0" "@babel/code-frame" "^7.14.0"
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
@ -6458,7 +6458,7 @@ gatsby-telemetry@^3.9.0:
boxen "^4.2.0" boxen "^4.2.0"
configstore "^5.0.1" configstore "^5.0.1"
fs-extra "^10.0.0" fs-extra "^10.0.0"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
git-up "^4.0.5" git-up "^4.0.5"
is-docker "^2.2.1" is-docker "^2.2.1"
lodash "^4.17.21" lodash "^4.17.21"
@ -6496,10 +6496,10 @@ gatsby-worker@^1.9.0:
"@babel/core" "^7.15.5" "@babel/core" "^7.15.5"
"@babel/runtime" "^7.15.4" "@babel/runtime" "^7.15.4"
gatsby@4.9.2: gatsby@4.9.3:
version "4.9.2" version "4.9.3"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-4.9.2.tgz#2a31f8fe8b5007ecfed67b78af27af0587fee817" resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-4.9.3.tgz#a69a05a47048b6d140c89cfc05c3cb0e24f8a7aa"
integrity sha512-dYUcCLZbyRIuzaswqxSzYFSGs+o1rdJFqZb6AODnq9jsMeDjN2jRC4DieDLzrWwDJCerW3rupDrHWsNfDj68Mw== integrity sha512-XZFmdW30vm1+s/kSxFFhMVl33u2qesWPdLEFtrQgtAnFiVjI/ukS/95gVOilhIMYyiTtuhQXiBKygkTl08oKFw==
dependencies: dependencies:
"@babel/code-frame" "^7.14.0" "@babel/code-frame" "^7.14.0"
"@babel/core" "^7.15.5" "@babel/core" "^7.15.5"
@ -6526,8 +6526,8 @@ gatsby@4.9.2:
babel-plugin-add-module-exports "^1.0.4" babel-plugin-add-module-exports "^1.0.4"
babel-plugin-dynamic-import-node "^2.3.3" babel-plugin-dynamic-import-node "^2.3.3"
babel-plugin-lodash "^3.3.4" babel-plugin-lodash "^3.3.4"
babel-plugin-remove-graphql-queries "^4.9.0" babel-plugin-remove-graphql-queries "^4.9.1"
babel-preset-gatsby "^2.9.0" babel-preset-gatsby "^2.9.1"
better-opn "^2.1.1" better-opn "^2.1.1"
bluebird "^3.7.2" bluebird "^3.7.2"
body-parser "^1.19.0" body-parser "^1.19.0"
@ -6570,18 +6570,18 @@ gatsby@4.9.2:
find-cache-dir "^3.3.2" find-cache-dir "^3.3.2"
fs-exists-cached "1.0.0" fs-exists-cached "1.0.0"
fs-extra "^10.0.0" fs-extra "^10.0.0"
gatsby-cli "^4.9.0" gatsby-cli "^4.9.1"
gatsby-core-utils "^3.9.0" gatsby-core-utils "^3.9.1"
gatsby-graphiql-explorer "^2.9.0" gatsby-graphiql-explorer "^2.9.0"
gatsby-legacy-polyfills "^2.9.0" gatsby-legacy-polyfills "^2.9.0"
gatsby-link "^4.9.0" gatsby-link "^4.9.1"
gatsby-page-utils "^2.9.0" gatsby-page-utils "^2.9.1"
gatsby-parcel-config "^0.0.1" gatsby-parcel-config "^0.0.1"
gatsby-plugin-page-creator "^4.9.0" gatsby-plugin-page-creator "^4.9.1"
gatsby-plugin-typescript "^4.9.0" gatsby-plugin-typescript "^4.9.1"
gatsby-plugin-utils "^3.3.0" gatsby-plugin-utils "^3.3.0"
gatsby-react-router-scroll "^5.9.0" gatsby-react-router-scroll "^5.9.0"
gatsby-telemetry "^3.9.0" gatsby-telemetry "^3.9.1"
gatsby-worker "^1.9.0" gatsby-worker "^1.9.0"
glob "^7.2.0" glob "^7.2.0"
got "^11.8.2" got "^11.8.2"

View File

@ -29,12 +29,6 @@ the health check.
The `portal-upgrade.sh` script upgrades the docker images for a portal and The `portal-upgrade.sh` script upgrades the docker images for a portal and
clears and leftover images. clears and leftover images.
**nginx-prune.sh**\
The `nginx-prune.sh` script deletes all entries from nginx cache larger than
the given size and smaller entries until nginx cache disk size is smaller than
the given cache size limit. Both values are configured in
`lib/nginx-prune-cache-subscript.sh`. The script doesn't require `sudo`.
## Webportal Upgrade Procedures ## Webportal Upgrade Procedures
TODO... TODO...

View File

@ -34,18 +34,16 @@ else
skylinks=("$1") # just single skylink passed as input argument skylinks=("$1") # just single skylink passed as input argument
fi fi
# get local nginx ip adress # get local skyd ip adress
nginx_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx) ipaddress=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sia)
# get sia api password either from env variable if exists or from apipassword file in sia-data directory
apipassword=$(docker exec sia sh -c '[ ! -z "${SIA_API_PASSWORD}" ] && echo ${SIA_API_PASSWORD} || $(cat /sia-data/apipassword | tr -d '\n')')
# iterate over provided skylinks and block them one by one # iterate over provided skylinks and block them one by one
for skylink in "${skylinks[@]}"; do for skylink in "${skylinks[@]}"; do
printf "Blocking ${skylink} ... " echo "> Blocking ${skylink} ... "
status_code=$(curl --write-out '%{http_code}' --silent --output /dev/null --data "{\"add\":[\"$skylink\"]}" "http://${nginx_ip}:8000/skynet/blocklist")
# print blocklist response status code # POST /skynet/blocklist always returns 200 and in case of failure print error message
if [ $status_code = "204" ]; then curl -A Sia-Agent -u "":${apipassword} --data "{\"add\":[\"$skylink\"]}" "http://${ipaddress}:9980/skynet/blocklist"
echo "done"
else
echo "error $status_code"
fi
done done

View File

@ -1,30 +0,0 @@
#!/usr/local/bin/bash
# This subscript is expected to be run inside docker container using 'bash'
# image. The image is based on Alpine Linux. It's tools (find, stat, awk, sort)
# are non-standard versions from BusyBox.
MAX_CACHE_DIR_SIZE=20000000000
MAX_KEEP_FILE_SIZE=1000000000
total=0
# We sort files by time, newest files are first. Format is:
# time (last modification as seconds since Epoch), filepath, size (bytes)
find /home/user/skynet-webportal/docker/data/nginx/cache -type f -exec stat -c "%Y %n %s" {} + | sort -rgk1 | while read line
do
size=$(echo $line | awk '{print $3}')
new_total=$(($total + $size))
# We always delete all files larger than MAX_KEEP_FILE_SIZE.
# We keep all files smaller than MAX_KEEP_FILE_SIZE when cache size is
# below MAX_CACHE_DIR_SIZE, then we delete also smaller files.
if (("$size" <= "$MAX_KEEP_FILE_SIZE" && "$new_total" < "$MAX_CACHE_DIR_SIZE"))
then
total=$new_total
continue
fi
filename=$(echo $line | awk '{print $2}')
rm $filename
done

View File

@ -1,9 +0,0 @@
#!/bin/bash
# We execute the nginx cache pruning subscript from docker container so that we
# can run the pruning script in user crontab without sudo.
docker run --rm -v /home/user:/home/user bash /home/user/skynet-webportal/scripts/lib/nginx-prune-cache-subscript.sh
# Some cache files are deleted, but are kept open, we hot reload nginx to get
# them closed and removed from filesystem.
docker exec nginx nginx -s reload

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from bot_utils import setup, send_msg from bot_utils import get_api_password, setup, send_msg
from random import randint from random import randint
from time import sleep from time import sleep
@ -11,6 +11,8 @@ import asyncio
import requests import requests
import json import json
from requests.auth import HTTPBasicAuth
setup() setup()
@ -38,14 +40,14 @@ def exec(command):
async def block_skylinks_from_airtable(): async def block_skylinks_from_airtable():
# Get nginx's IP before doing anything else. If this step fails we don't # Get sia IP before doing anything else. If this step fails we don't
# need to continue with the execution of the script. # need to continue with the execution of the script.
ipaddress = exec( ipaddress = exec(
"docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx" "docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sia"
) )
if ipaddress == "": if ipaddress == "":
print("Nginx's IP could not be detected. Exiting.") print("Skyd IP could not be detected. Exiting.")
return return
print("Pulling blocked skylinks from Airtable via api integration") print("Pulling blocked skylinks from Airtable via api integration")
@ -117,11 +119,13 @@ async def block_skylinks_from_airtable():
print( print(
"Sending /skynet/blocklist request with " "Sending /skynet/blocklist request with "
+ str(len(skylinks)) + str(len(skylinks))
+ " skylinks to siad through nginx" + " skylinks to siad"
) )
response = requests.post( response = requests.post(
"http://" + ipaddress + ":8000/skynet/blocklist", "http://" + ipaddress + ":9980/skynet/blocklist",
data=json.dumps({"add": skylinks}), data=json.dumps({"add": skylinks}),
headers={"User-Agent": "Sia-Agent"},
auth=HTTPBasicAuth("", get_api_password()),
) )
if response.status_code != 200: if response.status_code != 200:
@ -153,5 +157,5 @@ loop.run_until_complete(run_checks())
# --- BASH EQUIVALENT # --- BASH EQUIVALENT
# skylinks=$(curl "https://api.airtable.com/v0/${AIRTABLE_BASE}/${AIRTABLE_TABLE}?fields%5B%5D=${AIRTABLE_FIELD}" -H "Authorization: Bearer ${AIRTABLE_KEY}" | python3 -c "import sys, json; print('[\"' + '\",\"'.join([entry['fields']['Link'] for entry in json.load(sys.stdin)['records']]) + '\"]')") # skylinks=$(curl "https://api.airtable.com/v0/${AIRTABLE_BASE}/${AIRTABLE_TABLE}?fields%5B%5D=${AIRTABLE_FIELD}" -H "Authorization: Bearer ${AIRTABLE_KEY}" | python3 -c "import sys, json; print('[\"' + '\",\"'.join([entry['fields']['Link'] for entry in json.load(sys.stdin)['records']]) + '\"]')")
# ipaddress=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx) # ipaddress=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sia)
# curl --data "{\"add\" : ${skylinks}}" "${ipaddress}:8000/skynet/blocklist" # curl --data "{\"add\" : ${skylinks}}" "${ipaddress}:8000/skynet/blocklist"

View File

@ -5,4 +5,3 @@
44 5 * * * /home/user/skynet-webportal/scripts/backup-aws-s3.sh 1>>/home/user/skynet-webportal/logs/backup-aws-s3.log 2>>/home/user/skynet-webportal/logs/backup-aws-s3.log 44 5 * * * /home/user/skynet-webportal/scripts/backup-aws-s3.sh 1>>/home/user/skynet-webportal/logs/backup-aws-s3.log 2>>/home/user/skynet-webportal/logs/backup-aws-s3.log
6 13 * * * /home/user/skynet-webportal/scripts/db_backup.sh 1>>/home/user/skynet-webportal/logs/db_backup.log 2>>/home/user/skynet-webportal/logs/db_backup.log 6 13 * * * /home/user/skynet-webportal/scripts/db_backup.sh 1>>/home/user/skynet-webportal/logs/db_backup.log 2>>/home/user/skynet-webportal/logs/db_backup.log
0 5 * * * /home/user/skynet-webportal/scripts/es_cleaner.py 1 http://localhost:9200 0 5 * * * /home/user/skynet-webportal/scripts/es_cleaner.py 1 http://localhost:9200
15 * * * * /home/user/skynet-webportal/scripts/nginx-prune.sh