├── local ├── jsconfig.json ├── lib │ ├── cwd.js │ ├── exec.js │ └── doco.js ├── tasks │ ├── stop.js │ ├── install-minds.js │ ├── build-containers.js │ ├── start.js │ ├── restart.js │ ├── provision-mysql.js │ ├── wait-for-cassandra.js │ ├── provision-elasticsearch.js │ ├── build-front.js │ ├── cleanup-stack.js │ └── cleanup-front.js ├── front-build ├── local ├── ssr-serve ├── ssr-build ├── front-build.ps1 ├── ssr-serve.ps1 ├── local.ps1 ├── ssr-build.ps1 ├── commands │ ├── down.js │ ├── up.js │ ├── restart.js │ ├── rebuild.js │ ├── phpspec.js │ └── install.js ├── package.json ├── helpers │ ├── get-missing-deps.js │ └── repo-health.js ├── cli.js └── README.md ├── containers ├── alpine-rsync │ └── Dockerfile ├── plugins-cp │ └── Dockerfile ├── cassandra │ └── Dockerfile ├── redis │ ├── master.conf │ └── Dockerfile ├── wait-for-cassandra │ ├── Dockerfile │ └── wait-for-cassandra.sh ├── mysql-provisioner │ ├── Dockerfile │ ├── provision-mysql.sh │ └── provision.sql ├── nginx │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── nginx_entrypoint_dev_ssr.sh │ ├── Dockerfile.dev-ssr │ ├── nginx_entrypoint_dev.sh │ ├── nginx.conf │ ├── dev.conf │ ├── dev-ssr.conf.tpl │ └── minds.conf ├── elasticsearch-legacy │ └── clear-data-and-start.sh ├── repo-sync │ ├── sync.sh │ └── Dockerfile ├── elasticsearch │ └── set-permissions-and-start.sh ├── elasticsearch-provisioner │ ├── Dockerfile │ ├── schema │ │ ├── minds-graph-pass.json │ │ ├── minds-graph-subcriptions.json │ │ ├── minds-views.json │ │ ├── minds-offchain.json │ │ ├── minds-comments.json │ │ ├── minds-boost.json │ │ ├── minds-transactions-onchain.json │ │ ├── minds-search-user.json │ │ └── minds-search-activity_object.json │ ├── wait-for.sh │ └── provision-elasticsearch.sh └── ecs-update │ ├── Dockerfile │ ├── main.go │ └── plugin.go ├── errors ├── logo.png ├── logowhite.png ├── style.css ├── 502.html ├── 500.html └── 503.html ├── plugins └── _template │ ├── plugin.json │ ├── app │ └── plugin.ts │ ├── start.php │ └── Controllers │ └── api │ └── v1 │ └── _template.php ├── index.php ├── bin ├── emails │ ├── send.php │ └── sept-28.php ├── boostExpire.php ├── runPush.php ├── warehouse.php ├── setup-elastic.sh ├── regenerateDevKeys.php ├── searchIndex.php ├── misc │ ├── testData.php │ ├── plugins.php │ ├── oauth2.php │ └── emails.php ├── GUIDSERVER.php ├── upgrades │ └── 11.php ├── queueRunner.php ├── dwh.php ├── campaigns │ ├── push-rewards.php │ └── push-updateapp.php ├── cli.php ├── compileTrending.php ├── plugin.php └── bootstrap-ubuntu.sh ├── .gitmodules ├── docker-compose.with-phpspec.yml ├── .gitlab ├── issue_templates │ ├── feature │ ├── product-change.md │ ├── superhero.md │ ├── bug.md │ └── plus-tests.md └── insights.yml ├── init.sh ├── init.ps1 ├── README.md ├── docker-compose.yml └── LICENSE /local/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["**/*.js"] 3 | } 4 | -------------------------------------------------------------------------------- /containers/alpine-rsync/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | RUN apk add rsync 4 | -------------------------------------------------------------------------------- /errors/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Minds/minds/HEAD/errors/logo.png -------------------------------------------------------------------------------- /errors/logowhite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Minds/minds/HEAD/errors/logowhite.png -------------------------------------------------------------------------------- /containers/plugins-cp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | ## Copy plugins 4 | ADD plugins plugins -------------------------------------------------------------------------------- /containers/cassandra/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cassandra:4.0.7 2 | 3 | COPY cassandra.yaml /etc/cassandra/cassandra.yaml -------------------------------------------------------------------------------- /plugins/_template/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{plugin.name}}", 3 | "version": "1.0.0", 4 | "routes": { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /containers/redis/master.conf: -------------------------------------------------------------------------------- 1 | maxmemory-policy volatile-lru 2 | appendonly no 3 | appendfsync no 4 | SAVE "" 5 | timeout 0 6 | tcp-backlog 65536 -------------------------------------------------------------------------------- /local/lib/cwd.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = (...extras) => { 4 | return path.join(process.cwd(), '..', ...extras); 5 | }; 6 | -------------------------------------------------------------------------------- /local/tasks/stop.js: -------------------------------------------------------------------------------- 1 | const doco = require('../lib/doco'); 2 | 3 | module.exports = { 4 | title: 'Stopping containers', 5 | task: () => doco('down') 6 | }; 7 | -------------------------------------------------------------------------------- /containers/wait-for-cassandra/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cassandra:4.0.7 2 | 3 | WORKDIR /opt 4 | COPY wait-for-cassandra.sh /opt/ 5 | 6 | ENTRYPOINT ["sh", "./wait-for-cassandra.sh"] 7 | -------------------------------------------------------------------------------- /local/tasks/install-minds.js: -------------------------------------------------------------------------------- 1 | const doco = require('../lib/doco'); 2 | 3 | module.exports = { 4 | title: 'Installing Minds', 5 | task: () => doco('run', 'installer') 6 | }; 7 | -------------------------------------------------------------------------------- /local/tasks/build-containers.js: -------------------------------------------------------------------------------- 1 | const doco = require('../lib/doco'); 2 | 3 | module.exports = { 4 | title: 'Building containers', 5 | task: () => doco('build', '--no-cache') 6 | }; 7 | -------------------------------------------------------------------------------- /containers/mysql-provisioner/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql:8.0 2 | 3 | WORKDIR /provisioner 4 | COPY provision-mysql.sh provision.sql /provisioner/ 5 | 6 | ENTRYPOINT ["sh", "./provision-mysql.sh"] 7 | -------------------------------------------------------------------------------- /containers/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.13-alpine 2 | 3 | RUN rm /etc/nginx/conf.d/default.conf 4 | COPY nginx.conf /etc/nginx/nginx.conf 5 | COPY ./minds.conf /etc/nginx/conf.d/minds.conf 6 | -------------------------------------------------------------------------------- /local/front-build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "${BASH_SOURCE[0]}")" 5 | 6 | cd ../front && NODE_OPTIONS=--max_old_space_size=4096 npm run build:dev -- --delete-output-path=false 7 | -------------------------------------------------------------------------------- /local/tasks/start.js: -------------------------------------------------------------------------------- 1 | const doco = require('../lib/doco'); 2 | 3 | module.exports = { 4 | title: 'Starting containers', 5 | task: () => doco('up', '-d', 'nginx', 'runners', 'sockets', 'metascraper') 6 | }; 7 | -------------------------------------------------------------------------------- /containers/redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM redis:4.0-alpine 2 | 3 | COPY master.conf /usr/local/etc/redis/master.conf 4 | #COPY slave.conf /usr/local/etc/redis/slave.conf 5 | 6 | CMD [ "redis-server", "/usr/local/etc/redis/master.conf" ] -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | route(); 10 | -------------------------------------------------------------------------------- /local/local: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "${BASH_SOURCE[0]}")" 5 | 6 | npx npm-install-if-needed --package npm-install-if-needed@1.0 1> /dev/null 7 | NODE_OPTIONS=--max_old_space_size=4096 node cli.js $@ 8 | -------------------------------------------------------------------------------- /local/ssr-serve: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "${BASH_SOURCE[0]}")" 5 | 6 | cd ../front && npx nodemon --delay 3 --watch "dist/server.js" --watch "dist/server/**/*" --ext js,mjs --exec "npm" run serve:ssr 7 | -------------------------------------------------------------------------------- /containers/elasticsearch-legacy/clear-data-and-start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script wit ERRORLEVEL if any command fails 4 | set -e 5 | 6 | rm -rf /usr/share/elasticsearch/data/* 7 | exec /docker-entrypoint.sh elasticsearch 8 | -------------------------------------------------------------------------------- /local/tasks/restart.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | 3 | module.exports = { 4 | title: 'Restarting containers', 5 | task: () => new Listr([ 6 | require('./stop'), 7 | require('./start'), 8 | ]) 9 | }; 10 | -------------------------------------------------------------------------------- /containers/repo-sync/sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "SYNCING: $S3_BUCKET" 4 | 5 | aws s3 sync --exact-timestamps $S3_BUCKET $DIR 6 | 7 | echo "DONE" 8 | 9 | if [ $KEEP_ALIVE ] 10 | then 11 | while true; do sleep 1000; done 12 | fi -------------------------------------------------------------------------------- /containers/repo-sync/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN apk add --no-cache python py-pip && \ 4 | pip install awscli 5 | 6 | COPY sync.sh . 7 | 8 | RUN [ "chmod", "+x", "sync.sh" ] 9 | 10 | ENTRYPOINT '/sync.sh' 11 | 12 | CMD [ "" ] -------------------------------------------------------------------------------- /local/ssr-build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | cd "$(dirname "${BASH_SOURCE[0]}")" 5 | 6 | cd ../front && npx nodemon --delay 3 --watch "server.ts" --watch "dist/en/**/*" --ext js,css,jpg,png,svg,mp4,webp,webm --exec "npm" run build:ssr:dev 7 | -------------------------------------------------------------------------------- /containers/elasticsearch/set-permissions-and-start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script wit ERRORLEVEL if any command fails 4 | set -e 5 | 6 | chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data 7 | exec /usr/local/bin/docker-entrypoint.sh elasticsearch 8 | -------------------------------------------------------------------------------- /bin/emails/send.php: -------------------------------------------------------------------------------- 1 | setSubject($argv[1]); 8 | $campaign->setTemplate($argv[2]); 9 | $campaign->send(); 10 | -------------------------------------------------------------------------------- /bin/boostExpire.php: -------------------------------------------------------------------------------- 1 | autoExpire(); 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "engine"] 2 | path = engine 3 | url = https://gitlab.com/minds/engine.git 4 | [submodule "front"] 5 | path = front 6 | url = https://gitlab.com/minds/front.git 7 | [submodule "sockets"] 8 | path = sockets 9 | url = https://github.com/minds/sockets.git 10 | -------------------------------------------------------------------------------- /bin/runPush.php: -------------------------------------------------------------------------------- 1 | new Listr([ 7 | { 8 | title: 'Creating tables', 9 | task: () => doco('run', 'mysql-provisioner') 10 | }, 11 | ]) 12 | }; 13 | -------------------------------------------------------------------------------- /containers/nginx/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM nginx:1.13-alpine 2 | 3 | WORKDIR /var/www/Minds 4 | 5 | RUN rm /etc/nginx/conf.d/default.conf 6 | 7 | COPY nginx.conf /etc/nginx/nginx.conf 8 | COPY dev.conf /etc/nginx/conf.d/dev.conf 9 | COPY nginx_entrypoint_dev.sh /nginx_entrypoint_dev.sh 10 | 11 | ENTRYPOINT /nginx_entrypoint_dev.sh 12 | -------------------------------------------------------------------------------- /local/tasks/wait-for-cassandra.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const doco = require('../lib/doco'); 3 | 4 | module.exports = { 5 | title: 'Start Cassandra', 6 | task: () => new Listr([ 7 | { 8 | title: 'Waiting for Cassandra', 9 | task: () => doco('run', 'wait-for-cassandra') 10 | }, 11 | ]) 12 | }; 13 | -------------------------------------------------------------------------------- /containers/wait-for-cassandra/wait-for-cassandra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script wit ERRORLEVEL if any command fails 4 | set -e 5 | 6 | echo "Waiting for Cassandra to come online..." 7 | until cqlsh cassandra -e "show version" 8 | do 9 | echo "Ping..." 10 | sleep 1 11 | done 12 | 13 | echo "Cassandra is up and running" 14 | -------------------------------------------------------------------------------- /containers/nginx/nginx_entrypoint_dev_ssr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | export DOCKER_RESOLVER=$(cat /etc/resolv.conf | grep -i '^nameserver' | head -n1 | cut -d ' ' -f2) 5 | 6 | envsubst \$UPSTREAM_ENDPOINT,\$DOCKER_RESOLVER < /dev-ssr.conf.tpl > /etc/nginx/conf.d/dev.conf 7 | 8 | cat /etc/nginx/conf.d/dev.conf 9 | 10 | nginx -g "daemon off;" 11 | -------------------------------------------------------------------------------- /local/tasks/provision-elasticsearch.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const doco = require('../lib/doco'); 3 | 4 | module.exports = { 5 | title: 'Provisioning ElasticSearch', 6 | task: () => new Listr([ 7 | { 8 | title: 'Creating indices', 9 | task: () => doco('run', 'elasticsearch-provisioner') 10 | }, 11 | ]) 12 | }; 13 | -------------------------------------------------------------------------------- /plugins/_template/app/plugin.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Client } from '../../services/api'; 3 | 4 | @Component({ 5 | selector: 'plugin-{{plugin.lc_name}}', 6 | template: ` 7 | 8 | ` 9 | }) 10 | 11 | export class {{plugin.name; }} { 12 | 13 | constructor(private client : Client); { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /docker-compose.with-phpspec.yml: -------------------------------------------------------------------------------- 1 | # PHPSpec docker-compose 2 | version: "2.2" 3 | services: 4 | phpspec: 5 | build: 6 | context: ./engine 7 | dockerfile: ./containers/phpspec/Dockerfile 8 | volumes: 9 | - ./front/:/var/www/Minds/front:cached 10 | - ./engine/:/var/www/Minds/engine:cached 11 | - keys:/.dev 12 | networks: 13 | - app 14 | -------------------------------------------------------------------------------- /containers/nginx/Dockerfile.dev-ssr: -------------------------------------------------------------------------------- 1 | FROM nginx:1.13-alpine 2 | 3 | WORKDIR /var/www/Minds 4 | 5 | ENV UPSTREAM_ENDPOINT=front-live-server:4200 6 | 7 | RUN rm /etc/nginx/conf.d/default.conf 8 | 9 | COPY nginx.conf /etc/nginx/nginx.conf 10 | COPY dev-ssr.conf.tpl /dev-ssr.conf.tpl 11 | COPY nginx_entrypoint_dev_ssr.sh /nginx_entrypoint_dev_ssr.sh 12 | 13 | ENTRYPOINT /nginx_entrypoint_dev_ssr.sh 14 | -------------------------------------------------------------------------------- /local/front-build.ps1: -------------------------------------------------------------------------------- 1 | Push-Location $PSScriptRoot\..\front 2 | 3 | try { 4 | $env:NODE_OPTIONS = '--max_old_space_size=4096'; npm run build:dev -- --delete-output-path=false 5 | 6 | if ($LastExitCode -ne 0) { 7 | throw "Something failed" 8 | } 9 | } 10 | catch { 11 | Pop-Location 12 | exit 1 13 | } 14 | finally { 15 | Pop-Location 16 | exit 0 17 | } 18 | -------------------------------------------------------------------------------- /local/ssr-serve.ps1: -------------------------------------------------------------------------------- 1 | Push-Location $PSScriptRoot\..\front 2 | 3 | try { 4 | npx nodemon --delay 3 --watch dist/server.js --watch dist/server/**/* --ext js,mjs --exec "npm" run serve:ssr 5 | 6 | if ($LastExitCode -ne 0) { 7 | throw "Something failed" 8 | } 9 | } 10 | catch { 11 | Pop-Location 12 | exit 1 13 | } 14 | finally { 15 | Pop-Location 16 | exit 0 17 | } 18 | -------------------------------------------------------------------------------- /local/local.ps1: -------------------------------------------------------------------------------- 1 | Push-Location $PSScriptRoot 2 | 3 | try { 4 | npm i --silent --no-progress --no-audit --no-fund 5 | $env:NODE_OPTIONS = '--max_old_space_size=4096'; node cli.js $args 6 | 7 | if ($LastExitCode -ne 0) { 8 | throw "Something failed" 9 | } 10 | } 11 | catch { 12 | Pop-Location 13 | exit 1 14 | } 15 | finally { 16 | Pop-Location 17 | exit 0 18 | } 19 | -------------------------------------------------------------------------------- /local/ssr-build.ps1: -------------------------------------------------------------------------------- 1 | Push-Location $PSScriptRoot\..\front 2 | 3 | try { 4 | npx nodemon --delay 3 --watch server.ts --watch dist/en/**/* --ext js,css,jpg,png,svg,mp4,webp,webm --exec "npm" run build:ssr:dev 5 | 6 | if ($LastExitCode -ne 0) { 7 | throw "Something failed" 8 | } 9 | } 10 | catch { 11 | Pop-Location 12 | exit 1 13 | } 14 | finally { 15 | Pop-Location 16 | exit 0 17 | } 18 | -------------------------------------------------------------------------------- /local/commands/down.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | 3 | module.exports.handler = async argv => { 4 | let renderer = 'default'; 5 | 6 | if (argv.verbose) { 7 | renderer = 'verbose'; 8 | } else if (argv.silent) { 9 | renderer = 'silent' 10 | } 11 | 12 | const tasks = new Listr([ 13 | require('../tasks/stop'), 14 | ], { 15 | renderer 16 | }); 17 | 18 | await tasks.run(); 19 | }; 20 | 21 | module.exports.builder = {}; 22 | -------------------------------------------------------------------------------- /local/commands/up.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | 3 | module.exports.handler = async argv => { 4 | let renderer = 'default'; 5 | 6 | if (argv.verbose) { 7 | renderer = 'verbose'; 8 | } else if (argv.silent) { 9 | renderer = 'silent' 10 | } 11 | 12 | const tasks = new Listr([ 13 | require('../tasks/start'), 14 | ], { 15 | renderer 16 | }); 17 | 18 | await tasks.run(); 19 | }; 20 | 21 | module.exports.builder = {}; 22 | -------------------------------------------------------------------------------- /local/commands/restart.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | 3 | module.exports.handler = async argv => { 4 | let renderer = 'default'; 5 | 6 | if (argv.verbose) { 7 | renderer = 'verbose'; 8 | } else if (argv.silent) { 9 | renderer = 'silent' 10 | } 11 | 12 | const tasks = new Listr([ 13 | require('../tasks/restart'), 14 | ], { 15 | renderer 16 | }); 17 | 18 | await tasks.run(); 19 | }; 20 | 21 | module.exports.builder = {}; 22 | -------------------------------------------------------------------------------- /containers/ecs-update/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8-alpine 2 | 3 | RUN apk add --no-cache git 4 | 5 | RUN go get -u \ 6 | github.com/aws/aws-sdk-go \ 7 | github.com/Sirupsen/logrus \ 8 | github.com/joho/godotenv \ 9 | github.com/urfave/cli \ 10 | github.com/mattn/go-zglob 11 | 12 | COPY . . 13 | 14 | RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /bin/ecs-deploy 15 | 16 | ENV AWS_SDK_LOAD_CONFIG=1 17 | 18 | CMD [ "/bin/ecs-deploy" ] 19 | -------------------------------------------------------------------------------- /containers/mysql-provisioner/provision-mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script wit ERRORLEVEL if any command fails 4 | set -e 5 | 6 | echo "Provisioning MySQL"; 7 | echo "Waiting for MySQL to come online..." 8 | 9 | until mysql -h mysql -u root minds -e "SELECT 1" 10 | do 11 | echo "Ping..." 12 | sleep 1 13 | done 14 | 15 | echo "MySQL is up and running" 16 | 17 | echo "Creating tables" 18 | mysql -h mysql -u root minds < provision.sql 19 | 20 | echo "MySQL is ready!" 21 | -------------------------------------------------------------------------------- /local/commands/rebuild.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | 3 | module.exports.handler = async argv => { 4 | let renderer = 'default'; 5 | 6 | if (argv.verbose) { 7 | renderer = 'verbose'; 8 | } else if (argv.silent) { 9 | renderer = 'silent' 10 | } 11 | 12 | const tasks = new Listr([ 13 | require('../tasks/stop'), 14 | require('../tasks/build-containers'), 15 | ], { 16 | renderer 17 | }); 18 | 19 | await tasks.run(); 20 | }; 21 | 22 | module.exports.builder = {}; 23 | -------------------------------------------------------------------------------- /bin/warehouse.php: -------------------------------------------------------------------------------- 1 | run(array('sync', isset($argv[1]) ? $argv[1] : NULL)); 18 | $end = microtime(); 19 | 20 | $total = $end-$start; 21 | echo "\n\n TOOK: $total \n\n"; 22 | -------------------------------------------------------------------------------- /bin/setup-elastic.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz 4 | 5 | tar -xvf elasticsearch-1.7.2.tar.gz 6 | rm -rf elasticsearch 7 | mv elasticsearch-1.7.2 elasticsearch 8 | 9 | echo "network.bind_host: 127.0.0.1" >> elasticsearch/config/elasticsearch.yml 10 | 11 | elasticsearch/bin/elasticsearch -d 12 | 13 | echo "Installed. Run with \`./elasticsearch/bin/elasticsearch -d\`" 14 | 15 | php /var/www/Minds/misc/plugins.php 16 | 17 | rm elasticsearch-1.7.2.tar.gz 18 | -------------------------------------------------------------------------------- /local/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "minds-local-infrastructure", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "cli.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "dependencies": { 10 | "@alexbinary/rimraf": "1.0.2", 11 | "execa": "^4.0.0", 12 | "listr": "^0.14.3", 13 | "npm-install-if-needed": "^1.0.16", 14 | "prompts": "^2.3.0", 15 | "yargs": "^15.1.0" 16 | }, 17 | "author": "", 18 | "license": "GPL-3.0-or-later" 19 | } 20 | -------------------------------------------------------------------------------- /plugins/_template/start.php: -------------------------------------------------------------------------------- 1 | "sha512", 6 | "private_key_bits" => 4096, 7 | "private_key_type" => OPENSSL_KEYTYPE_RSA, 8 | ]); 9 | 10 | openssl_pkey_export($ssl, $privateKey); 11 | $publicKey = openssl_pkey_get_details($ssl)['key']; 12 | 13 | mkdir($target); 14 | file_put_contents("{$target}minds.pem", $privateKey); 15 | file_put_contents("{$target}minds.pub", $publicKey); 16 | -------------------------------------------------------------------------------- /errors/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background:#F2F2F2; 3 | font-family:"Ubuntu"; 4 | } 5 | .container{ 6 | width:auto; 7 | margin:10% auto; 8 | position:relative; 9 | } 10 | .logo{ 11 | width:225px; 12 | margin:auto; 13 | position:relative; 14 | } 15 | .logo img{ 16 | width:225px; 17 | } 18 | 19 | .message h1{ 20 | font-weight:normal; 21 | font-size:46px; 22 | text-align:center; 23 | } 24 | .message h3{ 25 | font-weight:lighter; 26 | font-size:18px; 27 | text-align:center; 28 | } 29 | a{ 30 | color: #4690D6; 31 | text-decoration:none; 32 | } 33 | -------------------------------------------------------------------------------- /local/helpers/get-missing-deps.js: -------------------------------------------------------------------------------- 1 | const exec = require('../lib/exec'); 2 | 3 | module.exports = async function() { 4 | const missingDeps = []; 5 | 6 | try { 7 | await exec('git', ['--version']); 8 | } catch (e) { 9 | missingDeps.push('git'); 10 | } 11 | 12 | try { 13 | await exec('docker', ['-v']); 14 | } catch (e) { 15 | missingDeps.push('docker'); 16 | } 17 | 18 | try { 19 | await exec('docker-compose', ['-v']); 20 | } catch (e) { 21 | missingDeps.push('docker-compose'); 22 | } 23 | 24 | return missingDeps; 25 | }; 26 | -------------------------------------------------------------------------------- /local/commands/phpspec.js: -------------------------------------------------------------------------------- 1 | const doco = require('../lib/doco'); 2 | 3 | module.exports.handler = async argv => { 4 | let renderer = 'default'; 5 | 6 | if (argv.verbose) { 7 | renderer = 'verbose'; 8 | } else if (argv.silent) { 9 | renderer = 'silent' 10 | } 11 | 12 | const subprocess = doco('run', 'phpspec', ...argv._.slice(1)); 13 | 14 | subprocess.stdout 15 | .pipe(process.stdout); 16 | 17 | subprocess.stderr 18 | .pipe(process.stderr); 19 | 20 | try { 21 | await subprocess; 22 | } catch (e) { 23 | console.log('\nCommand failed...'); 24 | process.exit(e.errorCode); 25 | } 26 | }; 27 | 28 | module.exports.builder = {}; 29 | -------------------------------------------------------------------------------- /bin/searchIndex.php: -------------------------------------------------------------------------------- 1 | 'video', 'limit'=>200, 'offset'=>$offset)); 18 | $offset= end($users)->guid; 19 | foreach($users as $user){ 20 | Minds\plugin\search\start::createDocument($user); 21 | } 22 | echo "imported.. \n"; 23 | } 24 | $end = microtime(true); 25 | 26 | $total = $end-$start; 27 | echo "\n\n TOOK: $total \n\n"; 28 | -------------------------------------------------------------------------------- /bin/misc/testData.php: -------------------------------------------------------------------------------- 1 | setMessage("Hello Minds!"); 10 | $guid = $activity->save(); 11 | 12 | Minds\Core\Boost\Factory::build('Newsfeed')->boost($guid, 1); 13 | Minds\Core\Events\Dispatcher::trigger('notification', 'elgg/hook/activity', array( 14 | 'to'=>array($user->guid), 15 | 'object_guid' => $guid, 16 | 'notification_view' => 'boost_submitted', 17 | 'params' => array('impressions'=>1), 18 | 'impressions' => 1 19 | )); 20 | 21 | echo "done"; 22 | -------------------------------------------------------------------------------- /bin/GUIDSERVER.php: -------------------------------------------------------------------------------- 1 | machine_id) ? ($CONFIG->machine_id) : 1; 11 | $port = 5599; 12 | $zks = 'localhost:2181'; 13 | 14 | $timer = new \Davegardnerisme\CruftFlake\Timer; 15 | if ($machine !== NULL) { 16 | $config = new \Davegardnerisme\CruftFlake\FixedConfig($machine); 17 | } else { 18 | $config = new \Davegardnerisme\CruftFlake\ZkConfig($zks); 19 | } 20 | $generator = new \Davegardnerisme\CruftFlake\Generator($config, $timer); 21 | $zmqRunner = new \Davegardnerisme\CruftFlake\ZeroMq($generator, $port); 22 | $zmqRunner->run(); 23 | -------------------------------------------------------------------------------- /local/lib/exec.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const fs = require('fs'); 3 | const cwd = require('./cwd'); 4 | 5 | function exec(relativePath, file, arguments, env = {}, opts = {}) { 6 | const workingDir = cwd(relativePath); 7 | 8 | if (!fs.existsSync(workingDir) || !fs.lstatSync(workingDir).isDirectory()) { 9 | throw new Error(`${workingDir} is not a directory`); 10 | } 11 | 12 | return execa(file, arguments, { 13 | cwd: workingDir, 14 | env: { 15 | ...process.env, 16 | ...env 17 | }, 18 | ...opts, 19 | }); 20 | } 21 | 22 | module.exports = (file, arguments, env = {}, opts = {}) => { 23 | return exec('', file, arguments, env, opts); 24 | }; 25 | 26 | module.exports.in = exec; 27 | -------------------------------------------------------------------------------- /bin/upgrades/11.php: -------------------------------------------------------------------------------- 1 | request($query->createTable("counters", array("guid"=>"varchar", "metric"=>"varchar", "count"=>"counter"), array("guid", "metric"))); 15 | echo "complete \n"; 16 | 17 | $client = Minds\Core\Data\Client::build('Cassandra'); 18 | $query = new Minds\Core\Data\Cassandra\Prepared\Counters(); 19 | $result = $client->request($query->setQuery("SELECT * from minds.counters")); 20 | var_dump($result); 21 | 22 | exit; 23 | -------------------------------------------------------------------------------- /bin/queueRunner.php: -------------------------------------------------------------------------------- 1 | run(); 29 | } catch(Exception $e){ 30 | echo "Failed: " . $e->getMessage() . " \n"; 31 | } 32 | -------------------------------------------------------------------------------- /local/tasks/build-front.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const exec = require('../lib/exec'); 3 | 4 | module.exports = { 5 | title: 'Setting up front', 6 | task: () => new Listr([ 7 | { 8 | title: 'Installing dependencies', 9 | task: () => exec.in('front', 'npm', ['install', '--legacy-peer-deps']) 10 | }, 11 | { 12 | title: 'Building app', 13 | task: () => exec.in('front', 'npm', ['run', 'build:dev', '--', '--watch=false'], { 14 | NODE_OPTIONS: '--max_old_space_size=4096' 15 | }) 16 | }, 17 | { 18 | title: 'Building SSR server', 19 | task: () => exec.in('front', 'npx', ['ng', 'run', 'minds:server:production'], { 20 | NODE_OPTIONS: '--max_old_space_size=4096' 21 | }) 22 | } 23 | ]) 24 | }; 25 | -------------------------------------------------------------------------------- /.gitlab/issue_templates/feature: -------------------------------------------------------------------------------- 1 | 7 | 8 | ### Summary 9 | 10 | (Summarize the feature concisely.) 11 | 12 | ### Detailed Description 13 | 14 | (Please be as detailed and precise as possible. ) 15 | 16 | ### Mockups 17 | 18 | (Include drawings, photos, or other media of the suggested feature) 19 | 20 | ### Links 21 | 22 | (Include any relevant links, including examples of a site that has this 23 | feature, or to Minds posts related to this feature request.) 24 | 25 | ### Other 26 | 27 | (Include any other information you think would be helpful.) 28 | 29 | /label ~ "feature" 30 | -------------------------------------------------------------------------------- /local/lib/doco.js: -------------------------------------------------------------------------------- 1 | const exec = require('./exec'); 2 | 3 | let upstreamEndpoint; 4 | 5 | switch (process.platform) { 6 | case 'win32': 7 | case 'darwin': 8 | upstreamEndpoint = 'host.docker.internal:4200'; 9 | break; 10 | 11 | default: 12 | upstreamEndpoint = '$remote_addr:4200'; 13 | useFrontContainer = false; 14 | break; 15 | } 16 | 17 | function buildDefaultArgs() { 18 | return [ 19 | '-f', 20 | 'docker-compose.yml', 21 | '-f', 22 | 'docker-compose.with-phpspec.yml', 23 | ]; 24 | } 25 | 26 | function buildEnv() { 27 | return { 28 | UPSTREAM_ENDPOINT: upstreamEndpoint, 29 | }; 30 | } 31 | 32 | module.exports = function (...args) { 33 | return exec('docker-compose', [ 34 | ...buildDefaultArgs(), 35 | ...args 36 | ], buildEnv()); 37 | }; 38 | -------------------------------------------------------------------------------- /bin/misc/plugins.php: -------------------------------------------------------------------------------- 1 | insert($plugin, array('type'=>'plugin', 'active'=>1, 'access_id'=>2)); 10 | } 11 | 12 | $search = new minds\plugin\search\start(array('active'=>true)); 13 | foreach(\elgg_get_entities(array('type'=>'user','limit'=>500)) as $entity){ 14 | /// if($entity->access_id == 2) 15 | $search->createDocument($entity); 16 | } 17 | foreach(\elgg_get_entities(array('type'=>'object','limit'=>500)) as $entity){ 18 | if($entity->access_id == 2) 19 | $search->createDocument($entity); 20 | } 21 | -------------------------------------------------------------------------------- /bin/misc/oauth2.php: -------------------------------------------------------------------------------- 1 | subtype = 'oauth2_client'; 7 | $entity->owner_guid = 0; 8 | $entity->access_id = ACCESS_PRIVATE; 9 | 10 | $entity->title = "test"; 11 | $entity->description = "test oauth"; 12 | 13 | $entity->client_id = $entity->guid; 14 | $entity->client_secret = \minds\plugin\oauth2\start::generateSecret(); 15 | 16 | if (!$entity->save()) { 17 | echo "failed to set oauth keys... \n"; 18 | } 19 | 20 | $db = new Minds\Core\Data\Call('plugin'); 21 | $db->insert('oauth2', array('type'=>'plugin', 'active'=>1, 'access_id'=>2)); 22 | 23 | echo "\n\n Your keys are: \n"; 24 | echo "client_id: $entity->guid \n"; 25 | echo "client_secret: $entity->client_secret \n"; 26 | -------------------------------------------------------------------------------- /plugins/_template/Controllers/api/v1/_template.php: -------------------------------------------------------------------------------- 1 | > /etc/hosts 9 | } 10 | 11 | echo -n "Checking if host.docker.internal resolves..." 12 | nslookup host.docker.internal > /dev/null 2>&1 13 | if [ $? == 0 ]; then 14 | echo " OK" 15 | else 16 | echo " FAIL" 17 | echo -n "Adding host.docker.internal to /etc/hosts..." 18 | add_host_entry 19 | if [ $? == 0 ]; then 20 | echo " OK"; 21 | else 22 | echo " FAIL"; 23 | fi 24 | fi 25 | echo "Starting Nginx..." 26 | nginx -g "daemon off;" 27 | -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | usage () { 5 | echo "Usage: init.sh [--ssh]" 6 | } 7 | 8 | # Argument parsing 9 | 10 | ssh= 11 | while [ "$1" != "" ]; do 12 | case $1 in 13 | --ssh ) ssh=1 14 | ;; 15 | * ) usage 16 | exit 1 17 | esac 18 | shift 19 | done 20 | 21 | # 22 | 23 | REMOTE_ROOT="https://gitlab.com/minds" 24 | 25 | if [ "$ssh" = "1" ]; then 26 | REMOTE_ROOT="git@gitlab.com:minds" 27 | fi 28 | 29 | # 30 | 31 | cd "$(dirname "${BASH_SOURCE[0]}")" 32 | 33 | # Clone the main repo 34 | git pull 35 | 36 | # Setup the other repos 37 | git clone $REMOTE_ROOT/front front --config core.autocrlf=input 38 | git clone $REMOTE_ROOT/engine engine --config core.autocrlf=input 39 | git clone $REMOTE_ROOT/sockets sockets --config core.autocrlf=input 40 | -------------------------------------------------------------------------------- /.gitlab/issue_templates/product-change.md: -------------------------------------------------------------------------------- 1 | ### Target problem 2 | 3 | (Describe the target persona (user or business), and the problem that the change is aimed to improve) 4 | 5 | ### Hypothesis 6 | 7 | (Describe the propoosed change and how it relates to the target problem) 8 | 9 | ### What is the primary metric that this change is aimed to improve? 10 | 11 | (Metric, KPI, and how it can be monitored) 12 | 13 | ### What is the current state of this metric, and what is the improvement goal? 14 | 15 | (Current value of the metric, target value of the metric) 16 | 17 | ### How does this change affect the desired metric? 18 | 19 | (Explain how the proposed change relates to the metric) 20 | 21 | ### What counter metric will ensure that an increase in the primary metric is a positive for the product? 22 | 23 | (Metric, KPI, and how it can be monitored) 24 | 25 | ### Size estimate 26 | 27 | (Size estimate -- from Design + Dev -- required to deliver this change. Is just an estimate) 28 | -------------------------------------------------------------------------------- /.gitlab/issue_templates/superhero.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ### Is minds.com down? 12 | 13 | (If minds.com is not down, then please double check that you should be declaring a Superhero) 14 | 15 | ### What is the issue? 16 | 17 | (Be as detailed as possible). 18 | 19 | ### What username are you logged in with? 20 | 21 | (If not loggedin, please say so). 22 | 23 | ### Console logs 24 | 25 | (Right click > Inspect Element > Console - Copy everything into the block below). 26 | 27 | ``` 28 | Copy your console log here 29 | ``` 30 | 31 | /label ~"Type::Superhero" ~"Superhero::Triggered" 32 | -------------------------------------------------------------------------------- /local/helpers/repo-health.js: -------------------------------------------------------------------------------- 1 | const exec = require('../lib/exec'); 2 | 3 | module.exports = async function() { 4 | const getAutoCrLf = async dir => { 5 | try { 6 | const subprocess = await exec.in(dir, 'git', ['config', '--get', 'core.autocrlf']); 7 | return (subprocess.stdout || '').trim().toLowerCase(); 8 | } catch (e) { 9 | return false; 10 | } 11 | } 12 | 13 | const badAutoCrLfValue = 'true'; 14 | 15 | const willCauseIssues = (await Promise.all([ 16 | getAutoCrLf(''), 17 | getAutoCrLf('front'), 18 | getAutoCrLf('engine'), 19 | getAutoCrLf('sockets'), 20 | ])).some(autocrlf => autocrlf === badAutoCrLfValue); 21 | 22 | if (willCauseIssues) { 23 | process.stderr.write( 24 | `\nWARNING: One or more repositories have 'core.autocrlf' set to '${badAutoCrLfValue}'. ` + 25 | 'This will cause issues with containerized scripts and provisioners. Please check ' + 26 | 'Minds Developers documentation.\n\n' 27 | ); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-views.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "properties": { 4 | "@timestamp": { 5 | "type": "date" 6 | }, 7 | "campaign": { 8 | "type": "keyword" 9 | }, 10 | "delta": { 11 | "type": "integer" 12 | }, 13 | "entity_urn": { 14 | "type": "keyword" 15 | }, 16 | "medium": { 17 | "type": "keyword" 18 | }, 19 | "page_token": { 20 | "type": "keyword" 21 | }, 22 | "platform": { 23 | "type": "keyword" 24 | }, 25 | "position": { 26 | "type": "integer" 27 | }, 28 | "source": { 29 | "type": "keyword" 30 | }, 31 | "uuid": { 32 | "type": "keyword" 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.gitlab/issue_templates/bug.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | ### Summary 9 | 10 | (Summarize the bug encountered concisely) 11 | 12 | ### Steps to reproduce 13 | 14 | (How one can reproduce the issue - this is very important) 15 | 16 | ### Platform information 17 | 18 | (Browser, device, system stats, screen size) 19 | 20 | ### What is the current *bug* behavior? 21 | 22 | (What actually happens) 23 | 24 | ### What is the expected *correct* behavior? 25 | 26 | (What you should see instead) 27 | 28 | ### Relevant logs and/or screenshots 29 | 30 | (Paste any relevant logs - please use code blocks (```) to format console output, 31 | logs, and code as it's very hard to read otherwise.) 32 | 33 | ### Possible fixes 34 | 35 | (If you can, link to the line of code that might be responsible for the problem) 36 | 37 | /label ~"T \- Bug" ~"S \- Triage:new" 38 | -------------------------------------------------------------------------------- /local/tasks/cleanup-stack.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const util = require('util'); 3 | const fs = require('fs'); 4 | const rimraf = require('@alexbinary/rimraf'); 5 | const exec = require('../lib/exec'); 6 | const cwd = require('../lib/cwd'); 7 | const doco = require('../lib/doco'); 8 | 9 | const exists = util.promisify(fs.exists); 10 | const rename = util.promisify(fs.rename); 11 | 12 | module.exports = { 13 | title: 'Cleaning up stack', 14 | task: () => new Listr([ 15 | { 16 | title: 'Purging containers', 17 | task: () => doco('down', '-v', '--rmi=all') 18 | }, 19 | require('../tasks/build-containers'), 20 | { 21 | title: 'Pruning engine', 22 | task: async (ctx, task) => { 23 | const settingsPhp = cwd('engine', 'settings.php'); 24 | 25 | if (await exists(settingsPhp)) { 26 | const newName = cwd('engine', `settings.php-${Date.now()}.bak`); 27 | await rename(settingsPhp, newName); 28 | } else { 29 | return task.skip('No settings.php file present') 30 | } 31 | } 32 | } 33 | ]) 34 | }; 35 | -------------------------------------------------------------------------------- /bin/misc/emails.php: -------------------------------------------------------------------------------- 1 | getRow('user', array('limit' => 200, 'offset' => $offset)); 15 | $users = $entities->getRows(array_keys($guids), array('offset'=>'email', 'limit'=>1)); 16 | if(count($guids) <= 1) 17 | break; 18 | 19 | echo "Encrypting"; 20 | 21 | foreach($users as $guid => $data){ 22 | $user = new Minds\Entities\User($data); 23 | $user->setEmail($user->getEmail()); 24 | 25 | $entities->insert($guid, array('email'=>$user->email)); 26 | if($user->getEmail()) 27 | $lu->removeRow($user->getEmail()); 28 | 29 | $count++; 30 | echo "."; 31 | } 32 | 33 | end($guids); 34 | $offset = key($guids); 35 | echo "Done up to $offset \n"; 36 | 37 | } 38 | echo "\n Encrypted $count emails \n"; 39 | -------------------------------------------------------------------------------- /local/tasks/cleanup-front.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const util = require('util'); 3 | const fs = require('fs'); 4 | const rimraf = require('@alexbinary/rimraf'); 5 | const exec = require('../lib/exec'); 6 | const cwd = require('../lib/cwd'); 7 | const doco = require('../lib/doco'); 8 | 9 | const exists = util.promisify(fs.exists); 10 | const rename = util.promisify(fs.rename); 11 | 12 | module.exports = { 13 | title: 'Cleaning up front', 14 | task: () => new Listr([ 15 | { 16 | title: 'Removing node_modules', 17 | task: async (ctx, task) => { 18 | const nodeModulesFolder = cwd('front', 'node_modules'); 19 | 20 | if (await exists(nodeModulesFolder)) { 21 | return await rimraf(nodeModulesFolder); 22 | } else { 23 | return task.skip('No node_modules directory present') 24 | } 25 | } 26 | }, 27 | { 28 | title: 'Removing dist', 29 | task: async (ctx, task) => { 30 | const distFolder = cwd('front', 'dist'); 31 | 32 | if (await exists(distFolder)) { 33 | return await rimraf(distFolder); 34 | } else { 35 | return task.skip('No dist directory present') 36 | } 37 | } 38 | }, 39 | ]) 40 | }; 41 | -------------------------------------------------------------------------------- /init.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | Param( 3 | [switch] $Ssh 4 | ) 5 | 6 | Set-StrictMode -Version latest 7 | $ErrorActionPreference = "Stop" 8 | 9 | Push-Location $PSScriptRoot 10 | 11 | function Exec 12 | { 13 | [CmdletBinding()] 14 | param( 15 | [Parameter(Position=0,Mandatory=1)][scriptblock]$cmd, 16 | [Parameter(Position=1,Mandatory=0)][string]$errorMessage = ("Error executing command {0}" -f $cmd) 17 | ) 18 | & $cmd 19 | if ($lastexitcode -ne 0) { 20 | Throw ("Exec: " + $errorMessage) 21 | } 22 | } 23 | 24 | Try { 25 | $RemoteRoot = "https://gitlab.com/minds" 26 | 27 | If ($Ssh) { 28 | $RemoteRoot = "git@gitlab.com:minds" 29 | } 30 | 31 | Write-Host "Using $RemoteRoot" 32 | 33 | # Fetch latest 34 | Exec { git pull } 35 | 36 | # Setup the other repos 37 | Exec { git clone $RemoteRoot/front.git front --config core.autocrlf=input } 38 | Exec { git clone $RemoteRoot/engine.git engine --config core.autocrlf=input } 39 | Exec { git clone $RemoteRoot/sockets.git sockets --config core.autocrlf=input } 40 | } 41 | Catch { 42 | Pop-Location 43 | Exit 1 44 | } 45 | Finally { 46 | Pop-Location 47 | Exit 0 48 | } 49 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-offchain.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "properties": { 4 | "@timestamp": { 5 | "type": "date" 6 | }, 7 | "amount": { 8 | "type": "double" 9 | }, 10 | "boost_guid": { 11 | "type": "long" 12 | }, 13 | "boost_handlder": { 14 | "type": "text", 15 | "fields": { 16 | "keyword": { 17 | "type": "keyword", 18 | "ignore_above": 256 19 | } 20 | } 21 | }, 22 | "boost_handler": { 23 | "type": "keyword" 24 | }, 25 | "contract": { 26 | "type": "keyword" 27 | }, 28 | "tx": { 29 | "type": "keyword" 30 | }, 31 | "user_guid": { 32 | "type": "long" 33 | }, 34 | "wire_entity_guid": { 35 | "type": "long" 36 | }, 37 | "wire_receiver_guid": { 38 | "type": "long" 39 | }, 40 | "wire_sender_guid": { 41 | "type": "long" 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /local/cli.js: -------------------------------------------------------------------------------- 1 | const yargs = require('yargs'); 2 | const getMissingDeps = require('./helpers/get-missing-deps'); 3 | const repoHealth = require('./helpers/repo-health'); 4 | 5 | return (async () => { 6 | const missingDeps = await getMissingDeps(); 7 | 8 | if (missingDeps.length) { 9 | process.stderr.write( 10 | `FATAL: Missing dependencies: ${missingDeps.join(', ')}\n` 11 | ); 12 | return process.exit(1); 13 | } 14 | 15 | await repoHealth(); 16 | 17 | return yargs 18 | .option('verbose', { 19 | description: 'Verbose output', 20 | boolean: true 21 | }) 22 | .option('silent', { 23 | description: 'Silent output', 24 | boolean: true 25 | }) 26 | .command(['up', 'start'], 'Start the containers', require('./commands/up')) 27 | .command(['down', 'stop'], 'Stop the containers', require('./commands/down')) 28 | .command('restart', 'Restart the containers', require('./commands/restart')) 29 | .command('rebuild', 'Rebuild the containers', require('./commands/rebuild')) 30 | .command('install', 'Installs and provisions the compose stack', require('./commands/install')) 31 | .command('phpspec', 'Runs PHPSpec on a container similar to GitLab CI', require('./commands/phpspec')) 32 | .demandCommand(1, 'Please, specify a command.') 33 | .help() 34 | .argv; 35 | })(); 36 | -------------------------------------------------------------------------------- /errors/502.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Minds - We are running a little hot. 4 | 5 | 46 | 47 | 48 |
49 | 50 |
51 |

We are running a little hot.

52 |

Please wait a moment and then hit refresh.

53 |
54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /errors/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Minds - Something broke. 4 | 49 | 50 | 51 | 52 |
53 | 54 |
55 |

There seems to be a problem.

56 |

Our engineers have been notified. Please check back soon.

57 |
58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /errors/503.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Minds - Service Outage. 4 | 49 | 50 | 51 | 52 |
53 | 54 |
55 |

There seems to be a problem.

56 |

Something broke along the way. We're onto it.. hold tight.

57 |
58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /.gitlab/issue_templates/plus-tests.md: -------------------------------------------------------------------------------- 1 | # Minds+ Tests 2 | 3 | Please perform all tests with the following prerequisites: 4 | 5 | - A new browser session is used for each test 6 | - You are using a test account 7 | - Staging cookie is set `staging=1` 8 | 9 | _Please place and X in the `[ ]` brackets if the test passes. If the test fails, then please provide steps to replicate below the line_ 10 | 11 | ## Joining Minds+ 12 | 13 | ### Logged out state 14 | 15 | - [ ] Can you navigate to Minds+ purchase page? 16 | - [ ] Are you prompted to login when clicking on the upgrade prompt? 17 | 18 | ### Logged in state 19 | 20 | - [ ] Can you navigate to Minds+ purchase page? 21 | 22 | ### From a Minds+ post 23 | 24 | - [ ] Can you navigate to the Minds+ page in the sidebar? 25 | - [ ] Click on a post to go to a full page view 26 | - [ ] Can you click on the Unlock button 27 | - [ ] Are you promted with a Minds+ upgrade screen? 28 | 29 | ## Posting to Plus 30 | 31 | - [ ] Can you submit a text post to Minds+ 32 | - [ ] Can you submit a video to Minds+ 33 | - [ ] Can you submit an image to Minds+ 34 | 35 | ## Interacting with Minds+ posts 36 | 37 | - [ ] Can you interact with a Minds+ post if you do not have Minds+ subscription (comment, vote up, vote down -- Refresh to confirm action not applied) 38 | 39 | ## Leaving Minds+ 40 | 41 | - [ ] Do you see a Cancel Minds+ button? 42 | - [ ] Does clicking on the cancel button work? 43 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-comments.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "properties": { 4 | "@timestamp": { 5 | "type": "date" 6 | }, 7 | "updated_at": { 8 | "type": "date" 9 | }, 10 | "guid": { 11 | "type": "long" 12 | }, 13 | "entity_guid": { 14 | "type": "long" 15 | }, 16 | "owner_guid": { 17 | "type": "long" 18 | }, 19 | "parent_guid": { 20 | "type": "long" 21 | }, 22 | "parent_depth": { 23 | "type": "integer" 24 | }, 25 | "body": { 26 | "type": "text" 27 | }, 28 | "mature": { 29 | "type": "boolean" 30 | }, 31 | "edited": { 32 | "type": "boolean" 33 | }, 34 | "spam": { 35 | "type": "boolean" 36 | }, 37 | "deleted": { 38 | "type": "boolean" 39 | }, 40 | "enabled": { 41 | "type": "boolean" 42 | }, 43 | "access_id": { 44 | "type": "long" 45 | }, 46 | "group_conversation": { 47 | "type": "boolean" 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bin/dwh.php: -------------------------------------------------------------------------------- 1 | 'user', 'limit' => $limit, 'offset'=>$offset]); 22 | foreach($users as $user){ 23 | $ts = Minds\Core\Analytics\Timestamps::get(['day', 'month'], $user->time_created); 24 | $db->insert("analytics:signup:day:{$ts['day']}", [$user->guid => $user->time_created]); 25 | $db->insert("analytics:signup:month:{$ts['month']}", [$user->guid => $user->time_created]); 26 | } 27 | if(count($users) < $limit){ 28 | break; 29 | } 30 | $offset = end($users)->guid; 31 | echo date('d-m-Y h:i', end($users)->time_created) . "\n"; 32 | //break; 33 | } 34 | echo "Done \n"; 35 | break; 36 | 37 | case "retention": 38 | echo "Calculating retention rates.. this may take a moment \n"; 39 | $app = Minds\Core\Analytics\App::_() 40 | ->setMetric('retention') 41 | ->increment(); 42 | echo "Done \n"; 43 | break; 44 | case "cron": 45 | break; 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-boost.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "properties": { 4 | "@completed": { 5 | "type": "date" 6 | }, 7 | "@rejected": { 8 | "type": "date" 9 | }, 10 | "@reviewed": { 11 | "type": "date" 12 | }, 13 | "@revoked": { 14 | "type": "date" 15 | }, 16 | "@timestamp": { 17 | "type": "date" 18 | }, 19 | "bid": { 20 | "type": "double" 21 | }, 22 | "bid_type": { 23 | "type": "keyword" 24 | }, 25 | "entity_guid": { 26 | "type": "long" 27 | }, 28 | "impressions": { 29 | "type": "long" 30 | }, 31 | "impressions_met": { 32 | "type": "long" 33 | }, 34 | "nsfw": { 35 | "type": "keyword" 36 | }, 37 | "owner_guid": { 38 | "type": "long" 39 | }, 40 | "priority": { 41 | "type": "boolean" 42 | }, 43 | "rating": { 44 | "type": "integer" 45 | }, 46 | "tags": { 47 | "type": "keyword" 48 | }, 49 | "token_method": { 50 | "type": "keyword" 51 | }, 52 | "type": { 53 | "type": "keyword" 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /bin/campaigns/push-rewards.php: -------------------------------------------------------------------------------- 1 | array( 13 | 'cert'=> '/var/secure/apns-production.pem' 14 | // 'sandbox'=>true, 15 | // 'cert'=> '/var/secure/apns.pem' 16 | ), 17 | 'Google' => array( 18 | 'api_key' => 'AIzaSyCp0LVJLY7SzTlxPqVn2-2zWZXQKb1MscQ' 19 | ))); 20 | 21 | $count = 0; 22 | $offset = isset($argv[1]) ? $argv[1] : ""; 23 | while(true){ 24 | $guids = $indexes->getRow('user', array('limit' => 750, 'offset' => $offset)); 25 | $users = $entities->getRows(array_keys($guids), array('offset'=>'surge_token', 'limit'=>1)); 26 | if(count($guids) <= 1) 27 | break; 28 | 29 | echo "Notifying "; 30 | 31 | foreach($users as $guid => $data){ 32 | if(!isset($data['surge_token'])) 33 | continue; 34 | 35 | $msg = "Use Minds today to get 10 free points!"; 36 | $message = Surge\Messages\Factory::build($data['surge_token']) 37 | ->setTitle($msg) 38 | ->setMessage($msg) 39 | ->setURI('newsfeed') 40 | ->setSound('default'); 41 | 42 | //Surge\Surge::send($message, $config); 43 | 44 | $count++; 45 | echo "."; 46 | } 47 | 48 | end($guids); 49 | $offset = key($guids); 50 | echo "Done up to $offset \n"; 51 | 52 | } 53 | echo "\n Sent $count push notifications \n"; 54 | 55 | -------------------------------------------------------------------------------- /bin/campaigns/push-updateapp.php: -------------------------------------------------------------------------------- 1 | array( 13 | 'cert'=> '/var/secure/apns-production.pem' 14 | // 'sandbox'=>true, 15 | // 'cert'=> '/var/secure/apns.pem' 16 | ), 17 | 'Google' => array( 18 | 'api_key' => 'AIzaSyCp0LVJLY7SzTlxPqVn2-2zWZXQKb1MscQ' 19 | ))); 20 | 21 | $count = 0; 22 | $offset = isset($argv[1]) ? $argv[1] : ""; 23 | while(true){ 24 | $guids = $indexes->getRow('user', array('limit' => 1000, 'offset' => $offset)); 25 | $users = $entities->getRows(array_keys($guids), array('offset'=>'surge_token', 'limit'=>1)); 26 | if(count($guids) <= 1) 27 | break; 28 | 29 | echo "Notifying "; 30 | 31 | foreach($users as $guid => $data){ 32 | if(!isset($data['surge_token'])) 33 | continue; 34 | 35 | $msg = "Upgrade today to try encrypted video chat ;-)"; 36 | $message = Surge\Messages\Factory::build($data['surge_token']) 37 | ->setTitle($msg) 38 | ->setMessage($msg) 39 | ->setURI('newsfeed') 40 | ->setSound('default'); 41 | 42 | Surge\Surge::send($message, $config); 43 | 44 | $count++; 45 | echo "."; 46 | } 47 | 48 | end($guids); 49 | $offset = key($guids); 50 | echo "Done up to $offset \n"; 51 | 52 | } 53 | echo "\n Sent $count push notifications \n"; 54 | 55 | -------------------------------------------------------------------------------- /local/commands/install.js: -------------------------------------------------------------------------------- 1 | const Listr = require('listr'); 2 | const prompts = require('prompts'); 3 | 4 | module.exports.handler = async argv => { 5 | let renderer = 'default'; 6 | 7 | if (argv.verbose) { 8 | renderer = 'verbose'; 9 | } else if (argv.silent) { 10 | renderer = 'silent' 11 | } 12 | 13 | if (process.platform === 'win32') { 14 | console.log('\nWARNING: Close any tool that might be watching Minds folder (e.g. VSCode, TortoiseGit, etc.)\n'); 15 | } 16 | 17 | const scope = []; 18 | 19 | if (argv.front) { 20 | scope.push('front build'); 21 | } 22 | 23 | if (argv.stack) { 24 | scope.push('local stack'); 25 | } 26 | 27 | const prompt = await prompts([ 28 | { 29 | type: 'toggle', 30 | name: 'confirm', 31 | message: `This will WIPE: [${scope.join(', ')}], if exists. Proceed?`, 32 | active: 'Yes', 33 | inactive: 'No' 34 | } 35 | ]); 36 | 37 | console.log(''); 38 | 39 | if (!prompt.confirm) { 40 | console.log('Cancelled by user'); 41 | process.exit(1); 42 | } 43 | 44 | const tasks = new Listr([ 45 | require('../tasks/stop'), 46 | argv.front && require('../tasks/cleanup-front'), 47 | argv.front && require('../tasks/build-front'), 48 | argv.stack && require('../tasks/cleanup-stack'), 49 | argv.stack && require('../tasks/provision-elasticsearch'), 50 | argv.stack && require('../tasks/provision-mysql'), 51 | argv.stack && require('../tasks/wait-for-cassandra'), 52 | argv.stack && require('../tasks/install-minds'), 53 | require('../tasks/restart'), 54 | ].filter(Boolean), { 55 | renderer 56 | }); 57 | 58 | await tasks.run(); 59 | }; 60 | 61 | module.exports.builder = { 62 | front: { 63 | default: true, 64 | }, 65 | stack: { 66 | default: true, 67 | }, 68 | }; 69 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/wait-for.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # https://github.com/eficode/wait-for/blob/master/wait-for 3 | TIMEOUT=15 4 | QUIET=0 5 | 6 | echoerr() { 7 | if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi 8 | } 9 | 10 | usage() { 11 | exitcode="$1" 12 | cat << USAGE >&2 13 | Usage: 14 | $cmdname host:port [-t timeout] [-- command args] 15 | -q | --quiet Do not output any status messages 16 | -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout 17 | -- COMMAND ARGS Execute command with args after the test finishes 18 | USAGE 19 | exit "$exitcode" 20 | } 21 | 22 | wait_for() { 23 | for i in `seq $TIMEOUT` ; do 24 | nc -z "$HOST" "$PORT" > /dev/null 2>&1 25 | 26 | result=$? 27 | if [ $result -eq 0 ] ; then 28 | if [ $# -gt 0 ] ; then 29 | exec "$@" 30 | fi 31 | exit 0 32 | fi 33 | sleep 1 34 | done 35 | echo "Operation timed out" >&2 36 | exit 1 37 | } 38 | 39 | while [ $# -gt 0 ] 40 | do 41 | case "$1" in 42 | *:* ) 43 | HOST=$(printf "%s\n" "$1"| cut -d : -f 1) 44 | PORT=$(printf "%s\n" "$1"| cut -d : -f 2) 45 | shift 1 46 | ;; 47 | -q | --quiet) 48 | QUIET=1 49 | shift 1 50 | ;; 51 | -t) 52 | TIMEOUT="$2" 53 | if [ "$TIMEOUT" = "" ]; then break; fi 54 | shift 2 55 | ;; 56 | --timeout=*) 57 | TIMEOUT="${1#*=}" 58 | shift 1 59 | ;; 60 | --) 61 | shift 62 | break 63 | ;; 64 | --help) 65 | usage 0 66 | ;; 67 | *) 68 | echoerr "Unknown argument: $1" 69 | usage 1 70 | ;; 71 | esac 72 | done 73 | 74 | if [ "$HOST" = "" -o "$PORT" = "" ]; then 75 | echoerr "Error: you need to provide a host and port to test." 76 | usage 2 77 | fi 78 | 79 | wait_for "$@" 80 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-transactions-onchain.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "properties": { 4 | "@timestamp": { 5 | "type": "date" 6 | }, 7 | "blockHash": { 8 | "type": "keyword" 9 | }, 10 | "blockNumber": { 11 | "type": "long" 12 | }, 13 | "contractAddress": { 14 | "type": "keyword" 15 | }, 16 | "ethUsdRate": { 17 | "type": "float" 18 | }, 19 | "ethValue": { 20 | "type": "float" 21 | }, 22 | "from": { 23 | "type": "keyword" 24 | }, 25 | "function": { 26 | "type": "keyword" 27 | }, 28 | "gas": { 29 | "type": "long" 30 | }, 31 | "gasPriceEth": { 32 | "type": "float" 33 | }, 34 | "gasUsed": { 35 | "type": "long" 36 | }, 37 | "hash": { 38 | "type": "keyword" 39 | }, 40 | "isTokenTransaction": { 41 | "type": "boolean" 42 | }, 43 | "to": { 44 | "type": "keyword" 45 | }, 46 | "tokenValue": { 47 | "type": "float" 48 | }, 49 | "transactionCategory": { 50 | "type": "keyword" 51 | }, 52 | "transactionDirection": { 53 | "type": "keyword" 54 | }, 55 | "transactionType": { 56 | "type": "keyword" 57 | }, 58 | "usdValue": { 59 | "type": "float" 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /containers/ecs-update/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/joho/godotenv" 8 | "github.com/urfave/cli" 9 | ) 10 | 11 | var build = "0" // build number set at compile-time 12 | 13 | func main() { 14 | app := cli.NewApp() 15 | app.Name = "ecs update plugin" 16 | app.Usage = "ecs update plugin" 17 | app.Action = run 18 | app.Version = fmt.Sprintf("1.0.%s", build) 19 | app.Flags = []cli.Flag{ 20 | cli.StringFlag{ 21 | Name: "access-key", 22 | Usage: "aws access key", 23 | EnvVar: "PLUGIN_ACCESS_KEY,AWS_ACCESS_KEY_ID", 24 | }, 25 | cli.StringFlag{ 26 | Name: "secret-key", 27 | Usage: "aws secret key", 28 | EnvVar: "PLUGIN_SECRET_KEY,AWS_SECRET_ACCESS_KEY", 29 | }, 30 | cli.StringFlag{ 31 | Name: "cluster", 32 | Usage: "ecs cluster name (or arn)", 33 | EnvVar: "PLUGIN_CLUSTER,ECS_CLUSTER", 34 | }, 35 | cli.StringFlag{ 36 | Name: "region", 37 | Usage: "aws region", 38 | Value: "us-east-1", 39 | EnvVar: "PLUGIN_REGION,ECS_REGION", 40 | }, 41 | cli.StringFlag{ 42 | Name: "service", 43 | Usage: "service to update", 44 | EnvVar: "PLUGIN_SERVICE,ECS_SERVICE", 45 | }, 46 | cli.BoolTFlag{ 47 | Name: "yaml-verified", 48 | Usage: "Ensure the yaml was signed", 49 | EnvVar: "DRONE_YAML_VERIFIED", 50 | }, 51 | cli.StringFlag{ 52 | Name: "env-file", 53 | Usage: "source env file", 54 | }, 55 | } 56 | 57 | if err := app.Run(os.Args); err != nil { 58 | fmt.Println("Error", err); 59 | } 60 | } 61 | 62 | func run(c *cli.Context) error { 63 | if c.String("env-file") != "" { 64 | _ = godotenv.Load(c.String("env-file")) 65 | } 66 | 67 | plugin := NewPlugin( 68 | c.String("access-key"), 69 | c.String("secret-key"), 70 | c.String("cluster"), 71 | c.String("service"), 72 | c.String("region"), 73 | ) 74 | 75 | return plugin.Exec() 76 | } 77 | -------------------------------------------------------------------------------- /bin/cli.php: -------------------------------------------------------------------------------- 1 | loadConfigs(); 41 | $minds->loadLegacy(); 42 | 43 | if (method_exists($handler, 'setApp')) { 44 | $handler->setApp($minds); 45 | } 46 | 47 | if (isset($help)) { 48 | $handler->help($handler->getExecCommand()); 49 | } else { 50 | $errorlevel = $handler->{$handler->getExecCommand()}(); 51 | echo PHP_EOL; 52 | exit((int) $errorlevel); 53 | } 54 | } catch (Minds\Exceptions\CliException $e) { 55 | echo PHP_EOL . "{$_SCRIPTNAME}: [ERROR] {$e->getMessage()}" . PHP_EOL; 56 | exit(1); 57 | } catch (\Exception $e) { 58 | $exceptionClass = get_class($e); 59 | echo PHP_EOL . "{$_SCRIPTNAME}: [EXCEPTION:{$exceptionClass}] {$e->getMessage()}" . PHP_EOL; 60 | exit(1); 61 | } 62 | 63 | echo PHP_EOL; 64 | exit(0); 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Minds 2 | 3 | Minds is an open-source, encrypted and reward-based social networking platform. https://minds.com 4 | 5 | ## Docs 6 | 7 | Full documentation can be found at [https://developers.minds.com/](https://developers.minds.com/). We suggest getting started at the [introduction](https://developers.minds.com/docs/getting-started/introduction/). 8 | 9 | ## Repositories 10 | 11 | Minds is split into multiple repositories: 12 | 13 | - [Engine](https://gitlab.com/minds/engine) - Backend code & APIs 14 | - [Front](https://gitlab.com/minds/front) - Client side Angular2 web app 15 | - [Sockets](https://gitlab.com/minds/sockets) - WebSocket server for real-time communication 16 | - [Mobile](https://gitlab.com/minds/mobile-native) - React Native mobile apps 17 | 18 | ## Development Installation 19 | 20 | See our [installation guide](https://developers.minds.com/docs/getting-started/introduction/) to get your local stack up and running 21 | 22 | ## Troubleshooting 23 | 24 | Having trouble with your local stack? See [troubleshooting](https://developers.minds.com/docs/getting-started/troubleshooting/) 25 | 26 | ## Contributing 27 | 28 | If you'd like to contribute to the Minds project, check out [how to contribute](https://developers.minds.com/docs/contributing/contributing/) or head right over to the [Minds Open Source Community](https://www.minds.com/groups/profile/365903183068794880). If you've found or fixed a bug, let us know in the [Minds Help and Support Group](https://www.minds.com/groups/profile/100000000000000681/activity)! 29 | 30 | ## Security reports 31 | 32 | Please report all security issues to [security@minds.com](mailto:security@minds.com). 33 | 34 | ## License and Copyright 35 | 36 | General license and copyright information is located [here](https://developers.minds.com/docs/getting-started/introduction/#license), and the AGPLv3 fine print is available [here](https://developers.minds.com/docs/contributing/license/). In addition, please see the license file of each repository. 37 | -------------------------------------------------------------------------------- /bin/compileTrending.php: -------------------------------------------------------------------------------- 1 | request($prepared->getTrendingUsers(0, 750)); 19 | $rows = $result->getRows(); 20 | 21 | $g = new GUID(); 22 | $guids = array(); 23 | $i = -1; 24 | foreach ($rows['user'] as $user) { 25 | $user = Entities\Factory::build($user['guid']); 26 | 27 | if ($user->getSpam() || $user->getDeleted()) { 28 | continue; 29 | } 30 | 31 | $key = $g->migrate($i++); 32 | $guids[$key] = $user['guid']; 33 | } 34 | 35 | echo count($guids); 36 | 37 | $db = new Core\Data\Call('entities_by_time'); 38 | $db->insert('trending:user', $guids); 39 | 40 | echo "[complete] \n"; 41 | 42 | $subtypes = ['image', 'video']; 43 | 44 | foreach($subtypes as $subtype){ 45 | 46 | echo "Collecting trending {$subtype}s:: \n"; 47 | 48 | $result= Core\Data\Client::build('Neo4j')->request($prepared->getTrendingObjects($subtype, 0, 750)); 49 | $rows = $result->getRows(); 50 | 51 | $g = new GUID(); 52 | $guids = array(); 53 | $i = -1; 54 | foreach ($rows['object'] as $object) { 55 | $entity = Entities\Factory::build($object['guid']); 56 | $owner = Entities\Factory::build($entity->owner_guid); 57 | if($entity && $entity->getFlag('mature')) 58 | continue; 59 | if($entity && $entity->getFlag('spam')) 60 | continue; 61 | if($entity && $entity->getFlag('deleted')) 62 | continue; 63 | if($owner && $owner->getMatureContent()) 64 | continue; 65 | $key = $g->migrate($i++); 66 | $guids[$key] = $object['guid']; 67 | } 68 | 69 | echo count($guids); 70 | 71 | $db = new Core\Data\Call('entities_by_time'); 72 | $db->removeRow('trending:' . $subtype); 73 | $db->insert('trending:' . $subtype, $guids); 74 | 75 | echo "[complete] \n"; 76 | 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/provision-elasticsearch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script wit ERRORLEVEL if any command fails 4 | set -e 5 | 6 | echo "Provisioning elastic search"; 7 | echo "Waiting for elastic search to come online..." 8 | ./wait-for.sh $1:9200 --timeout=120 -- echo "Elastic search is up and running" 9 | 10 | echo "Putting mappings" 11 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-activity -d @./schema/minds-search-activity_object.json --header "Content-Type: application/json" 12 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-object-image -d @./schema/minds-search-user_group.json --header "Content-Type: application/json" 13 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-object-video -d @./schema/minds-search-user_group.json --header "Content-Type: application/json" 14 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-object-blog -d @./schema/minds-search-user_group.json --header "Content-Type: application/json" 15 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-user -d @./schema/minds-search-user_group.json --header "Content-Type: application/json" 16 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-search-group -d @./schema/minds-search-user_group.json --header "Content-Type: application/json" 17 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-views -d @./schema/minds-views.json --header "Content-Type: application/json" 18 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-boost -d @./schema/minds-boost.json --header "Content-Type: application/json" 19 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-offchain -d @./schema/minds-offchain.json --header "Content-Type: application/json" 20 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-transactions-onchain -d @./schema/minds-transactions-onchain.json --header "Content-Type: application/json" 21 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-graph-subscriptions -d @./schema/minds-graph-subscriptions.json --header "Content-Type: application/json" 22 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-graph-pass -d @./schema/minds-graph-pass.json --header "Content-Type: application/json" 23 | curl -s --write-out ' Status: %{http_code}\n' -X PUT http://$1:9200/minds-comments -d @./schema/minds-comments.json --header "Content-Type: application/json" 24 | 25 | echo "elastic search is ready!" 26 | -------------------------------------------------------------------------------- /containers/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | user nginx; 3 | worker_processes 1; 4 | 5 | error_log /dev/stdout warn; 6 | pid /var/run/nginx.pid; 7 | 8 | 9 | events { 10 | worker_connections 20000; #20k 11 | } 12 | 13 | 14 | http { 15 | include /etc/nginx/mime.types; 16 | default_type application/octet-stream; 17 | 18 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 19 | '$status $body_bytes_sent "$http_referer" ' 20 | '"$http_user_agent" "$http_x_forwarded_for"'; 21 | 22 | access_log off; 23 | 24 | sendfile on; 25 | #tcp_nopush on; 26 | client_max_body_size 2G; #2gb upload limit 27 | 28 | keepalive_timeout 130; # We allow s3 timeouts of 120s 29 | 30 | gzip on; 31 | gzip_comp_level 6; 32 | gzip_min_length 1100; 33 | gzip_buffers 16 8k; 34 | gzip_proxied any; 35 | gzip_types 36 | text/plain 37 | text/css 38 | text/js 39 | text/xml 40 | text/javascript 41 | application/javascript 42 | application/json 43 | application/xml 44 | application/rss+xml 45 | image/svg+xml; 46 | 47 | ## PHP caches 48 | fastcgi_cache_path /tmp/nginx_cache 49 | levels=1:2 50 | keys_zone=fastcgicache:10m 51 | max_size=1g 52 | inactive=30m; 53 | fastcgi_cache_lock on; 54 | fastcgi_cache_use_stale error timeout invalid_header updating http_500; 55 | fastcgi_cache_valid 5m; 56 | fastcgi_cache_key "$scheme$request_method$host$request_uri$http_authorization$http_accept_language"; 57 | fastcgi_ignore_headers Cache-Control Expires Set-Cookie; 58 | 59 | ## Node caches 60 | # proxy_cache_path /tmp/node_cache 61 | # levels=1:2 62 | # keys_zone=node_cache:10m 63 | # max_size=10g 64 | # inactive=60m; 65 | 66 | merge_slashes on; 67 | 68 | set_real_ip_from 127.0.0.1; 69 | real_ip_header X-Forwarded-For; 70 | 71 | ########################################################## 72 | ### THESE VALUES SHOULD MATCH ANGULAR.JSON LOCALE LIST ### 73 | map $http_accept_language $browser_locale { 74 | default en; 75 | ~*^cs cs; 76 | ~*^de de; 77 | ~*^es es; 78 | ~*^fr fr; 79 | ~*^hi hi; 80 | ~*^it it; 81 | ~*^ja ja; 82 | ~*^nl nl; 83 | ~*^pl pl; 84 | ~*^pt pt; 85 | ~*^ro ro; 86 | ~*^ru ru; 87 | ~*^sv sv; 88 | ~*^uk uk; 89 | ~*^th th; 90 | ~*^vi vi; 91 | } 92 | 93 | map $cookie_hl $locale { 94 | default $browser_locale; 95 | ~en en; 96 | ~cs cs; 97 | ~de de; 98 | ~es es; 99 | ~fr fr; 100 | ~hi hi; 101 | ~it it; 102 | ~ja ja; 103 | ~nl nl; 104 | ~pl pl; 105 | ~pt pt; 106 | ~ro ro; 107 | ~ru ru; 108 | ~sv sv; 109 | ~uk uk; 110 | ~th th; 111 | ~vi vi; 112 | } 113 | ######################################################## 114 | 115 | include /etc/nginx/conf.d/*.conf; 116 | } 117 | -------------------------------------------------------------------------------- /.gitlab/insights.yml: -------------------------------------------------------------------------------- 1 | issues: 2 | title: Issues Dashboard 3 | charts: 4 | - title: Issues created per month 5 | type: bar 6 | query: 7 | issuable_type: issue 8 | issuable_state: all 9 | group_by: month 10 | - title: Issues closed per month 11 | type: bar 12 | query: 13 | issuable_type: issue 14 | issuable_state: closed 15 | group_by: month 16 | - title: Superhero Calls 17 | type: bar 18 | query: 19 | issuable_type: issue 20 | issuable_state: all 21 | filter_labels: 22 | - Type::Superhero 23 | group_by: month 24 | - title: Regressions per month by environment 25 | type: stacked-bar 26 | query: 27 | issuable_type: issue 28 | issuable_state: all 29 | filter_labels: 30 | - Type::Regression 31 | collection_labels: 32 | - Regression::Production 33 | - Regression::Canary 34 | - Regression::Staging 35 | group_by: month 36 | - title: Bugs created per month by Priority 37 | type: stacked-bar 38 | query: 39 | issuable_type: issue 40 | issuable_state: all 41 | filter_labels: 42 | - Type::Bug 43 | collection_labels: 44 | - Priority::0 - Urgent 45 | - Priority::1 - High 46 | - Priority::2 - Normal 47 | - Priority::3 - Nice to have 48 | - Priority::4 - Trivial 49 | group_by: month 50 | - title: All open issues by Priority 51 | type: bar 52 | query: 53 | issuable_type: issue 54 | issuable_state: open 55 | collection_labels: 56 | - Priority::0 - Urgent 57 | - Priority::1 - High 58 | - Priority::2 - Normal 59 | - Priority::3 - Nice to have 60 | - Priority::4 - Trivial 61 | - title: All open bugs by Priority 62 | type: bar 63 | query: 64 | issuable_type: issue 65 | issuable_state: open 66 | filter_labels: 67 | - Type::Bug 68 | collection_labels: 69 | - Priority::0 - Urgent 70 | - Priority::1 - High 71 | - Priority::2 - Normal 72 | - Priority::3 - Nice to have 73 | - Priority::4 - Trivial 74 | - title: All open issues by Type 75 | type: bar 76 | query: 77 | issuable_type: issue 78 | issuable_state: open 79 | collection_labels: 80 | - Type::Bug 81 | - Type::Superhero 82 | - Type::Feature 83 | - Type::Chore 84 | - Type::Regression 85 | - Type::E2E 86 | - Type::Refactor 87 | - Type::LowEnergyHighImpact 88 | - Type::QA 89 | # - title: Bugs created per month by Severity 90 | # type: stacked-bar 91 | # query: 92 | # issuable_type: issue 93 | # filter_labels: 94 | # - bug 95 | # collection_labels: 96 | # - S::1 97 | # - S::2 98 | # - S::3 99 | # - S::4 100 | # group_by: month 101 | mergeRequests: 102 | title: Merge Requests Dashboard 103 | charts: 104 | - title: Merge Requests merged per week 105 | type: bar 106 | query: 107 | issuable_type: merge_request 108 | issuable_state: merged 109 | group_by: week 110 | - title: Merge Requests merged per month 111 | type: bar 112 | query: 113 | issuable_type: merge_request 114 | issuable_state: merged 115 | group_by: month 116 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-search-user.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "dynamic": "strict", 4 | "properties": { 5 | "@moderated": { 6 | "type": "date" 7 | }, 8 | "@timestamp": { 9 | "type": "date" 10 | }, 11 | "access_id": { 12 | "type": "keyword" 13 | }, 14 | "briefdescription": { 15 | "type": "text" 16 | }, 17 | "container_guid": { 18 | "type": "keyword" 19 | }, 20 | "deleted": { 21 | "type": "boolean" 22 | }, 23 | "email_confirmed_at": { 24 | "type": "long" 25 | }, 26 | "group_membership": { 27 | "type": "keyword" 28 | }, 29 | "guid": { 30 | "type": "keyword" 31 | }, 32 | "language": { 33 | "type": "keyword" 34 | }, 35 | "license": { 36 | "type": "keyword" 37 | }, 38 | "mature": { 39 | "type": "boolean" 40 | }, 41 | "merchant": { 42 | "type": "boolean" 43 | }, 44 | "moderator_guid": { 45 | "type": "keyword" 46 | }, 47 | "name": { 48 | "type": "keyword" 49 | }, 50 | "nsfw": { 51 | "type": "integer" 52 | }, 53 | "owner_guid": { 54 | "type": "keyword" 55 | }, 56 | "pending": { 57 | "type": "boolean" 58 | }, 59 | "plus_expires": { 60 | "type": "date" 61 | }, 62 | "pro_expires": { 63 | "type": "date" 64 | }, 65 | "public": { 66 | "type": "boolean" 67 | }, 68 | "rating": { 69 | "type": "long" 70 | }, 71 | "subtype": { 72 | "type": "keyword" 73 | }, 74 | "suggest": { 75 | "type": "completion", 76 | "analyzer": "standard", 77 | "preserve_separators": true, 78 | "preserve_position_increments": true, 79 | "max_input_length": 50 80 | }, 81 | "tags": { 82 | "type": "keyword" 83 | }, 84 | "time_created": { 85 | "type": "integer" 86 | }, 87 | "type": { 88 | "type": "keyword" 89 | }, 90 | "urls": { 91 | "type": "nested", 92 | "properties": { 93 | "domain": { 94 | "type": "keyword" 95 | }, 96 | "full": { 97 | "type": "keyword" 98 | }, 99 | "path": { 100 | "type": "keyword" 101 | }, 102 | "registered_domain": { 103 | "type": "keyword" 104 | }, 105 | "scheme": { 106 | "type": "keyword" 107 | }, 108 | "top_level_domain": { 109 | "type": "keyword" 110 | } 111 | } 112 | }, 113 | "username": { 114 | "type": "keyword" 115 | } 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /bin/plugin.php: -------------------------------------------------------------------------------- 1 | [args]'], true, true); 51 | } 52 | 53 | $operations = [ 54 | 'list', 55 | 'enable', 56 | 'disable', 57 | 'purge', 58 | 'clear-cache', 59 | ]; 60 | $operation = $argv[1]; 61 | 62 | if (!in_array($operation, $operations)) { 63 | _out(['invalid plugin operation'], true); 64 | } 65 | 66 | define('__MINDS_ROOT__', realpath(dirname(__FILE__) . '/../engine')); 67 | require_once(__MINDS_ROOT__ . "/vendor/autoload.php"); 68 | 69 | $minds = new Minds\Core\Minds(); 70 | $minds->loadConfigs(); 71 | $minds->loadLegacy(); 72 | 73 | $path = dirname(__MINDS_ROOT__) . '/plugins/'; 74 | $plugins = get_from_dir($path); 75 | $db = new \Minds\Core\Data\Call('plugin'); 76 | $plugins_db = $db->getRows($plugins); // TODO: Get ALL rows, not just the folders (to detect orphaned) 77 | $dirty = false; 78 | 79 | switch ($operation) { 80 | case 'list': 81 | _out(['list of Minds plugins']); 82 | 83 | foreach ($plugins as $plugin) { 84 | $active_checkmark = isset($plugins_db[$plugin]['active']) ? 'X' : ' '; 85 | _out(["[{$active_checkmark}] {$plugin}"]); 86 | } 87 | break; 88 | case 'enable': 89 | if (!isset($argv[2])) { 90 | _out(["missing plugin name"], true); 91 | } 92 | 93 | $plugin = $argv[2]; 94 | if (!in_array($plugin, $plugins)) { 95 | _out(["plugin `{$plugin}` doesn't exists"], true); 96 | } 97 | 98 | if (isset($plugins_db[$plugin]['active']) && $plugins_db[$plugin]['active']) { 99 | _out(["plugin `{$plugin}` is already enabled"], true); 100 | } 101 | 102 | $new_state = 1; 103 | break; 104 | case 'disable': 105 | if (!isset($argv[2])) { 106 | _out(["missing plugin name"], true); 107 | } 108 | 109 | $plugin = $argv[2]; 110 | if (!in_array($plugin, $plugins)) { 111 | _out(["plugin `{$plugin}` doesn't exists"], true); 112 | } 113 | 114 | if (!isset($plugins_db[$plugin]['active']) || !$plugins_db[$plugin]['active']) { 115 | _out(["plugin `{$plugin}` is already disabled"], true); 116 | } 117 | 118 | $new_state = 0; 119 | break; 120 | case 'purge': 121 | // TODO: Clear orphaned plugin entries (exists on DB, missing on FS) 122 | $dirty = true; 123 | break; 124 | case 'clear-cache': 125 | $dirty = true; 126 | break; 127 | } 128 | 129 | if (isset($plugin) && isset($new_state)) { 130 | $db->insert($plugin, [ 'type' => 'plugin', 'active' => $new_state, 'access_id' => 2 ]); 131 | $dirty = true; 132 | 133 | _out(["plugin `{$plugin}` was " . ($new_state ? 'enabled' : 'disabled')]); 134 | } 135 | 136 | if ($dirty) { 137 | plugins::purgeCache('plugins:active'); 138 | _out(['cleared plugin cache']); 139 | } 140 | -------------------------------------------------------------------------------- /containers/nginx/dev.conf: -------------------------------------------------------------------------------- 1 | map $http_upgrade $connection_upgrade { 2 | default upgrade; 3 | '' close; 4 | } 5 | 6 | server { 7 | listen 80; 8 | listen [::]:80 default ipv6only=on; 9 | listen 8080; 10 | root /var/www/Minds/front/dist; 11 | 12 | index index.php index.html; 13 | server_name _; 14 | 15 | error_log /dev/stdout warn; 16 | access_log off; 17 | 18 | if ($host = 'minds.com' ) { 19 | rewrite ^/(.*)$ https://www.minds.com/$1 permanent; 20 | } 21 | 22 | #if ($http_x_forwarded_proto != "https") { 23 | # rewrite ^(.*)$ https://$host$REQUEST_URI permanent; 24 | #} 25 | 26 | sendfile off; 27 | 28 | location / { 29 | port_in_redirect off; 30 | 31 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 32 | proxy_set_header Host $http_host; 33 | proxy_set_header X-NginX-Proxy true; 34 | proxy_pass http://host.docker.internal:4200; 35 | proxy_redirect off; 36 | proxy_http_version 1.1; 37 | proxy_set_header Upgrade $http_upgrade; 38 | proxy_set_header Connection "upgrade"; 39 | proxy_redirect off; 40 | proxy_set_header X-Forwarded-Proto $scheme; 41 | } 42 | 43 | location ~ ^(/api|/fs|/icon|/carousel|/emails/unsubscribe) { 44 | add_header 'Access-Control-Allow-Origin' "$http_origin"; 45 | add_header 'Access-Control-Allow-Credentials' 'true'; 46 | add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; 47 | add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With,X-No-Cache'; 48 | 49 | rewrite ^(.+)$ /index.php last; 50 | } 51 | 52 | location ~ (.woff|.tff) { 53 | add_header 'Access-Control-Allow-Origin' *; 54 | } 55 | 56 | location ~ ^/(manifest.webmanifest|ngsw-worker.js|ngsw.json|safety-worker.js|worker-basic.min.js)$ { 57 | rewrite /var/www/Minds/front/dist/browser/en/$1 last; 58 | } 59 | 60 | location ~ (composer.json|composer.lock|.travis.yml){ 61 | deny all; 62 | } 63 | 64 | location @rewrite { 65 | rewrite ^(.+)$ /index.php last; 66 | } 67 | 68 | # Do not cache by default 69 | set $no_cache 1; 70 | 71 | # Cache GET requests by default 72 | if ($request_method = GET){ 73 | set $no_cache 0; 74 | } 75 | 76 | # Do not cache if we have a cookie set 77 | if ($http_cookie ~ "(mindsperm)" ){ 78 | set $no_cache 1; 79 | } 80 | 81 | # Do not cache if we have a logged in cookie 82 | if ($cookie_minds_sess) { 83 | set $no_cache 1; 84 | } 85 | 86 | if ($request_uri ~ /api/v3/friendly-captcha/puzzle) { 87 | set $no_cache 1; 88 | } 89 | 90 | # pass the PHP scripts to FastCGI server listening on socket 91 | location ~ \.php$ { 92 | add_header X-Cache $upstream_cache_status; 93 | add_header No-Cache $no_cache; 94 | add_header X-No-Cache $no_cache; 95 | 96 | fastcgi_cache fastcgicache; 97 | fastcgi_cache_bypass $no_cache; 98 | fastcgi_no_cache $no_cache; 99 | 100 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 101 | fastcgi_pass php-fpm:9000; 102 | fastcgi_index index.php; 103 | 104 | fastcgi_buffers 64 32k; 105 | fastcgi_buffer_size 64k; 106 | 107 | include fastcgi_params; 108 | fastcgi_param SCRIPT_FILENAME /var/www/Minds/engine/index.php; 109 | fastcgi_param PATH_INFO $fastcgi_path_info; 110 | } 111 | 112 | # location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { 113 | # expires 5d; 114 | # } 115 | 116 | location ~ /\. { 117 | log_not_found off; 118 | deny all; 119 | } 120 | 121 | # Proxy to Angular dev server (hmr websocket) 122 | location ^~ /sockjs-node/ { 123 | proxy_pass http://host.docker.internal:4200; 124 | proxy_set_header Host $host; 125 | proxy_http_version 1.1; 126 | proxy_set_header Upgrade $http_upgrade; 127 | proxy_set_header Connection "Upgrade"; 128 | proxy_max_temp_file_size 0; 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /containers/elasticsearch-provisioner/schema/minds-search-activity_object.json: -------------------------------------------------------------------------------- 1 | { 2 | "mappings": { 3 | "dynamic": "strict", 4 | "properties": { 5 | "@moderated": { 6 | "type": "date" 7 | }, 8 | "@timestamp": { 9 | "type": "date" 10 | }, 11 | "@wire_support_tier_expire": { 12 | "type": "date" 13 | }, 14 | "access_id": { 15 | "type": "keyword" 16 | }, 17 | "blurb": { 18 | "type": "text" 19 | }, 20 | "comments:count": { 21 | "type": "long" 22 | }, 23 | "comments:count:synced": { 24 | "type": "date" 25 | }, 26 | "container_guid": { 27 | "type": "keyword" 28 | }, 29 | "custom_type": { 30 | "type": "keyword" 31 | }, 32 | "deleted": { 33 | "type": "boolean" 34 | }, 35 | "description": { 36 | "type": "text" 37 | }, 38 | "entity_guid": { 39 | "type": "keyword" 40 | }, 41 | "guid": { 42 | "type": "keyword" 43 | }, 44 | "is_portrait": { 45 | "type": "boolean" 46 | }, 47 | "is_quoted_post": { 48 | "type": "boolean" 49 | }, 50 | "is_remind": { 51 | "type": "boolean" 52 | }, 53 | "is_supermind": { 54 | "type": "boolean" 55 | }, 56 | "is_supermind_reply": { 57 | "type": "boolean" 58 | }, 59 | "language": { 60 | "type": "keyword" 61 | }, 62 | "license": { 63 | "type": "keyword" 64 | }, 65 | "mature": { 66 | "type": "boolean" 67 | }, 68 | "message": { 69 | "type": "text" 70 | }, 71 | "moderator_guid": { 72 | "type": "keyword" 73 | }, 74 | "nsfw": { 75 | "type": "integer" 76 | }, 77 | "owner_guid": { 78 | "type": "keyword" 79 | }, 80 | "paywall": { 81 | "type": "boolean" 82 | }, 83 | "pending": { 84 | "type": "boolean" 85 | }, 86 | "public": { 87 | "type": "boolean" 88 | }, 89 | "rating": { 90 | "type": "long" 91 | }, 92 | "remind_guid": { 93 | "type": "keyword" 94 | }, 95 | "subtype": { 96 | "type": "keyword" 97 | }, 98 | "supermind_request_guid": { 99 | "type": "keyword" 100 | }, 101 | "tags": { 102 | "type": "keyword" 103 | }, 104 | "time_created": { 105 | "type": "integer" 106 | }, 107 | "title": { 108 | "type": "text" 109 | }, 110 | "type": { 111 | "type": "keyword" 112 | }, 113 | "urls": { 114 | "type": "nested", 115 | "properties": { 116 | "domain": { 117 | "type": "keyword" 118 | }, 119 | "full": { 120 | "type": "keyword" 121 | }, 122 | "path": { 123 | "type": "keyword" 124 | }, 125 | "registered_domain": { 126 | "type": "keyword" 127 | }, 128 | "scheme": { 129 | "type": "keyword" 130 | }, 131 | "top_level_domain": { 132 | "type": "keyword" 133 | } 134 | } 135 | }, 136 | "votes:down": { 137 | "type": "long" 138 | }, 139 | "votes:down:synced": { 140 | "type": "long" 141 | }, 142 | "votes:up": { 143 | "type": "long" 144 | }, 145 | "votes:up:synced": { 146 | "type": "long" 147 | }, 148 | "wire_support_tier": { 149 | "type": "keyword" 150 | } 151 | } 152 | } 153 | } -------------------------------------------------------------------------------- /containers/ecs-update/plugin.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | //"mime" 5 | //"os" 6 | "fmt" 7 | //"path/filepath" 8 | //"strings" 9 | 10 | //"errors" 11 | //log "github.com/Sirupsen/logrus" 12 | "github.com/aws/aws-sdk-go/aws" 13 | "github.com/aws/aws-sdk-go/aws/credentials" 14 | "github.com/aws/aws-sdk-go/aws/session" 15 | "github.com/aws/aws-sdk-go/service/ecs" 16 | "github.com/aws/aws-sdk-go/service/ecs/ecsiface" 17 | //"github.com/mattn/go-zglob" 18 | ) 19 | 20 | // Plugin defines the ECS update plugin parameters. 21 | type Plugin struct { 22 | Cluster string 23 | Key string 24 | Secret string 25 | Service string 26 | 27 | Region string 28 | 29 | Client ecsiface.ECSAPI 30 | } 31 | 32 | func NewPlugin(accessKey string, secretKey string, cluster string, service string, region string) *Plugin { 33 | 34 | // create the client 35 | conf := &aws.Config{ 36 | Region: aws.String(region), 37 | } 38 | 39 | //Allowing to use the instance role or provide a key and secret 40 | if accessKey != "" && secretKey != "" { 41 | conf.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, "") 42 | } 43 | client := ecs.New(session.New(), conf) 44 | 45 | return &Plugin{ 46 | Key: accessKey, 47 | Secret: secretKey, 48 | Cluster: cluster, 49 | Service: service, 50 | Region: region, 51 | Client: client, 52 | } 53 | } 54 | 55 | // Exec runs the plugin 56 | func (p *Plugin) Exec() error { 57 | 58 | taskDefinition, err := p.getTaskDefinitionFromService(); 59 | 60 | if err != nil { 61 | fmt.Println("Error", err); 62 | return nil 63 | } 64 | 65 | taskDefinitionArn, err := p.updateTaskDefinition(taskDefinition); 66 | 67 | if err != nil { 68 | fmt.Println("Error", err); 69 | return nil 70 | } 71 | 72 | err = p.updateService(taskDefinitionArn); 73 | 74 | if err != nil { 75 | fmt.Println("Error", err); 76 | return nil 77 | } 78 | 79 | fmt.Println("Completed"); 80 | 81 | return nil 82 | } 83 | 84 | func (p *Plugin) wait() error { 85 | params := &ecs.DescribeServicesInput{ 86 | Services: []*string{ 87 | aws.String(p.Service), 88 | }, 89 | Cluster: aws.String(p.Cluster), 90 | } 91 | 92 | return p.Client.WaitUntilServicesStable(params) 93 | } 94 | 95 | func (p *Plugin) updateService(taskDefinitionArn string) error { 96 | 97 | params := &ecs.UpdateServiceInput{ 98 | Service: aws.String(p.Service), 99 | Cluster: aws.String(p.Cluster), 100 | TaskDefinition: aws.String(taskDefinitionArn), 101 | } 102 | 103 | resp, err := p.Client.UpdateService(params) 104 | 105 | if err != nil { 106 | return err 107 | } 108 | 109 | service := resp.Service 110 | if *service.DesiredCount <= 0 { 111 | return nil 112 | } 113 | 114 | //return p.wait(); 115 | return nil 116 | } 117 | 118 | func (p *Plugin) updateTaskDefinition(taskDefinition *ecs.TaskDefinition) (string, error) { 119 | 120 | params := &ecs.RegisterTaskDefinitionInput{ 121 | ContainerDefinitions: taskDefinition.ContainerDefinitions, 122 | Family: taskDefinition.Family, 123 | NetworkMode: taskDefinition.NetworkMode, 124 | PlacementConstraints: taskDefinition.PlacementConstraints, 125 | TaskRoleArn: taskDefinition.TaskRoleArn, 126 | Volumes: taskDefinition.Volumes, 127 | } 128 | 129 | resp, err := p.Client.RegisterTaskDefinition(params); 130 | 131 | if err != nil { 132 | fmt.Println("Error", err); 133 | return "", err 134 | } 135 | 136 | taskDefinitionArn := *resp.TaskDefinition.TaskDefinitionArn; 137 | return taskDefinitionArn, nil 138 | } 139 | 140 | func (p *Plugin) getTaskDefinitionFromService() (*ecs.TaskDefinition, error) { 141 | 142 | // GET THE SERVICE 143 | params := &ecs.DescribeServicesInput{ 144 | Services: []*string{ 145 | aws.String(p.Service), 146 | }, 147 | Cluster: aws.String(p.Cluster), 148 | } 149 | 150 | resp, err := p.Client.DescribeServices(params) 151 | 152 | if err != nil { 153 | fmt.Println("Error", err); 154 | return nil, err 155 | } 156 | 157 | taskDefinitionArn := *resp.Services[0].Deployments[0].TaskDefinition; 158 | 159 | taskDefinition, err := p.getTaskDefinitionFromArn(taskDefinitionArn) 160 | 161 | return taskDefinition, err; 162 | } 163 | 164 | func (p *Plugin) getTaskDefinitionFromArn(taskDefinitionArn string) (*ecs.TaskDefinition, error) { 165 | 166 | //get the task definition 167 | params := &ecs.DescribeTaskDefinitionInput{ 168 | TaskDefinition: aws.String(taskDefinitionArn), 169 | } 170 | 171 | resp, err := p.Client.DescribeTaskDefinition(params) 172 | 173 | if err != nil { 174 | fmt.Println("Error", err); 175 | return nil, err 176 | } 177 | 178 | return resp.TaskDefinition, nil; 179 | 180 | } -------------------------------------------------------------------------------- /bin/emails/sept-28.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 69 | 70 | 71 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 32 | 33 | 34 |
14 | 15 | 16 |

17 | 18 |

19 | 20 | 21 |

Hey @!

22 | 23 |

It’s time to truly be rewarded for your energy on a social network. That’s why we expand your viral reach just for using this app by giving you points for voting, commenting, uploading, swiping, etc..

24 |

We want your voice to be heard rather than censored. We want you to have secure, encrypted communications to maintain your right to privacy.

25 |

For this reason, we just released an experimental version of encrypted video chat which you can now use on the mobile apps with users you are mutually subscribed to.

26 |

We also just amped up our reward system so that you now receive 10 points just for signing in to Minds each day. You can exchange these points directly for views on the content of your choice by clicking the BOOST button. Right now 1 point is equivalent to 1 free view on your content.

27 |

If you don’t have the mobile app yet, download it now here in order to use your points and access encrypted video chat.

28 |

Thank you for being a part of the Internet freedom evolution! We have more incredible announcements coming soon. Stay tuned!

29 |

@minds

30 | 31 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 51 | 52 | 53 |
42 | 43 | 44 | 45 | 47 | 48 | Android app on Google Play 49 | 50 |
54 | 55 | 56 | 57 | 58 | 59 | 60 | 65 | 66 | 67 |
61 | 62 | click here to un-subscribe 63 | from future emails. 64 |
68 |
72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /local/README.md: -------------------------------------------------------------------------------- 1 | # Local Stack 2 | 3 | ## Requirements 4 | - Any modern x86_64 multi-core CPU that supports virtualization. 5 | - 16GB of RAM (of which around 7.5GB should be devoted to Docker VM on macOS and Windows). 6 | - 3GB storage for Minds repositories and packages, and at least 20GB for Docker VM/Images. 7 | - Internet connectivity (only needed for downloading and provisioning the stack). 8 | 9 | ### Software requirements 10 | - Git 11 | - Docker 18 or higher, with docker-compose 12 | - Node.js 10.x or higher, with npm and npx 13 | - Port 8080 open 14 | 15 | #### Extra requirements for Windows 16 | - Windows 10 Pro with Hyper-V enabled (for Docker) 17 | - PowerShell 18 | 19 | ## Before installing 20 | 21 | ### Windows line endings 22 | Git on Windows defaults `core.autocrlf` setting to `true`, which causes installation, provisioning and entry-point scripts to become corrupted with Windows-style line endings. 23 | 24 | Before installing Minds, make sure you change it to `input` either globally **BEFORE** downloading the repositories (1); or by setting it when cloning (2). 25 | 26 | (1): `git config --global core.autocrlf input` 27 | 28 | (2): `git clone [repo] --config core.autocrlf=input` 29 | 30 | If you already downloaded Minds repositories, you'll have to either download it again, or do a hard reset in all the repositories, as seen on https://stackoverflow.com/a/10118312. 31 | 32 | You will get a warning every time your run the local stack if any of the repositories has the wrong `core.autocrlf` value. 33 | 34 | ## Run-from-anywhere aliases 35 | This is an optional step, but all examples in this document will be using the alias. 36 | 37 | ### Linux/macOS 38 | Add to your ~/.bashrc (or ~/.zshrc) file 39 | ```sh 40 | export $MINDSROOT=/path/to/minds 41 | 42 | alias minds=$MINDSROOT/local/local 43 | alias minds-front-build=$MINDSROOT/local/front-build 44 | alias minds-ssr-build=$MINDSROOT/local/ssr-build 45 | alias minds-ssr-serve=$MINDSROOT/local/ssr-serve 46 | ``` 47 | 48 | After saving the profile script, restart your terminal windows. 49 | 50 | ### Windows 51 | Open PowerShell and run 52 | ```powershell 53 | echo $profile 54 | ``` 55 | That command will output the location to your profile script. Edit it and add 56 | ```powershell 57 | $env:MINDSROOT = 'X:\Path\To\minds' 58 | 59 | Set-Alias -Name minds -Value $env:MINDSROOT\local\local.ps1 60 | Set-Alias -Name minds-front-build -Value $env:MINDSROOT\local\front-build.ps1 61 | Set-Alias -Name minds-ssr-build -Value $env:MINDSROOT\local\ssr-build.ps1 62 | Set-Alias -Name minds-ssr-serve -Value $env:MINDSROOT\local\ssr-serve.ps1 63 | ``` 64 | 65 | After saving the profile script, restart your terminal windows. 66 | 67 | ## Preparing your OS 68 | 69 | ### Linux 70 | - Nothing to do. 71 | 72 | ### macOS 73 | - Setup Docker VM to have at least 7.5GB and it uses at least 2 CPUs. 74 | 75 | ### Windows 76 | - Setup Docker VM to have at least 7.5GB and it uses at least 2 CPUs. 77 | - Enable Shared Drives availability to the drive that has the Minds repository (https://docs.docker.com/docker-for-windows/#file-sharing). 78 | 79 | ## Installing Minds 80 | > **Important!** 81 | > 82 | > This operation will wipe out all your current data in the Minds containers. 83 | > 84 | > Ensure you run `docker-compose down` to dispose old Docker containers **before updating `master` or checking out this branch**. 85 | 86 | Run 87 | ```sh 88 | minds install 89 | ``` 90 | 91 | ### Troubleshooting 92 | 93 | #### Random errors when building or starting the Docker containers 94 | 95 | Git might corrupted Docker container scripts line endings. [Read this](#windows-line-endings). 96 | 97 | #### There are random ENOENT or EPERM errors when cleaning up or building the frontend app during install on Windows 98 | 99 | Close any application that might be actively watching the folder, such as VSCode, TortoiseGit, etc. If it still fails, reboot your computer to release any rogue lock. 100 | 101 | ## Running 102 | 103 | ### Starting the containers 104 | 105 | Run 106 | ```sh 107 | minds up 108 | ``` 109 | 110 | ### Stopping the containers 111 | 112 | Run 113 | ```sh 114 | minds down 115 | ``` 116 | 117 | ### Restarting the containers 118 | 119 | Run 120 | ```sh 121 | minds restart 122 | ``` 123 | 124 | ### Rebuilding the containers 125 | After any infrastructure changes, run 126 | ```sh 127 | minds rebuild 128 | ``` 129 | 130 | ## Running the frontend stack 131 | 132 | #### App 133 | Run 134 | ```sh 135 | minds-front-build 136 | ``` 137 | 138 | #### SSR Server 139 | Open two consoles and run in the first one: 140 | ```sh 141 | minds-ssr-build 142 | ``` 143 | And in the seconds 144 | ```sh 145 | minds-ssr-serve 146 | ``` 147 | 148 | The last one might show an error first, but it's normal as your computer might be re-building the server at the time your started it. 149 | 150 | ## PHPSpec 151 | 152 | ### Running test suite 153 | Run 154 | ```sh 155 | minds phpspec 156 | ``` 157 | 158 | #### Running a directory 159 | Run 160 | ```sh 161 | minds phpspec run --format=pretty --no-code-generation Spec/.../ 162 | ``` 163 | 164 | #### Running a single file 165 | Run 166 | ```sh 167 | minds phpspec run --format=pretty --no-code-generation Spec/.../.../MyFileSpec.php 168 | ``` 169 | 170 | #### Creating a new spec 171 | 172 | #### Linux/macOS 173 | 174 | Run 175 | ```sh 176 | minds phpspec describe Minds\\...\\...\\MyClass 177 | ``` 178 | 179 | #### Windows 180 | 181 | Run 182 | ```powershell 183 | minds phpspec describe Minds\...\...\MyClass 184 | ``` 185 | -------------------------------------------------------------------------------- /containers/mysql-provisioner/provision.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `friends` ( 2 | `user_guid` bigint NOT NULL, 3 | `friend_guid` bigint NOT NULL, 4 | `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 5 | PRIMARY KEY (`user_guid`,`friend_guid`) 6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 7 | 8 | CREATE TABLE IF NOT EXISTS `nostr_events` ( 9 | `id` varchar(64) NOT NULL, 10 | `pubkey` varchar(64) NOT NULL, 11 | `created_at` timestamp NULL DEFAULT NULL, 12 | `kind` int DEFAULT NULL, 13 | `tags` text, 14 | `e_ref` varchar(64) DEFAULT NULL, 15 | `p_ref` varchar(64) DEFAULT NULL, 16 | `content` text, 17 | `sig` varchar(128) DEFAULT NULL, 18 | `deleted` tinyint(1) DEFAULT '0', 19 | PRIMARY KEY (`id`,`pubkey`) 20 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 21 | 22 | CREATE TABLE IF NOT EXISTS `nostr_kind_1_to_activity_guid` ( 23 | `id` varchar(64) NOT NULL, 24 | `activity_guid` bigint NOT NULL, 25 | `owner_guid` bigint DEFAULT NULL, 26 | `is_external` tinyint(1) DEFAULT NULL, 27 | PRIMARY KEY (`id`,`activity_guid`) 28 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 29 | 30 | CREATE TABLE IF NOT EXISTS `nostr_mentions` ( 31 | `id` varchar(64) NOT NULL, 32 | `pubkey` varchar(64) NOT NULL, 33 | PRIMARY KEY (`id`,`pubkey`), 34 | CONSTRAINT `nostr_mentions_ibfk_1` FOREIGN KEY (`id`) REFERENCES `nostr_events` (`id`) 35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 36 | 37 | CREATE TABLE IF NOT EXISTS `nostr_nip26_tokens` ( 38 | `delegate_pubkey` varchar(64) NOT NULL, 39 | `delegator_pubkey` varchar(64) DEFAULT NULL, 40 | `conditions_query_string` text, 41 | `sig` varchar(128) DEFAULT NULL, 42 | PRIMARY KEY (`delegate_pubkey`) 43 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 44 | 45 | CREATE TABLE IF NOT EXISTS `nostr_pubkey_whitelist` ( 46 | `pubkey` varchar(64) NOT NULL, 47 | PRIMARY KEY (`pubkey`) 48 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 49 | 50 | CREATE TABLE IF NOT EXISTS `nostr_replies` ( 51 | `id` varchar(64) NOT NULL, 52 | `event_id` varchar(64) NOT NULL, 53 | `relay_url` text, 54 | `marker` text, 55 | PRIMARY KEY (`id`,`event_id`), 56 | KEY `event_id` (`event_id`), 57 | CONSTRAINT `nostr_replies_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `nostr_events` (`id`) 58 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 59 | 60 | CREATE TABLE IF NOT EXISTS `nostr_users` ( 61 | `pubkey` varchar(64) NOT NULL, 62 | `user_guid` bigint DEFAULT NULL, 63 | `is_external` tinyint(1) DEFAULT NULL, 64 | PRIMARY KEY (`pubkey`) 65 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 66 | 67 | CREATE TABLE IF NOT EXISTS `pseudo_seen_entities` ( 68 | `pseudo_id` varchar(128) NOT NULL, 69 | `entity_guid` bigint NOT NULL, 70 | `last_seen_timestamp` timestamp NULL DEFAULT NULL, 71 | PRIMARY KEY (`pseudo_id`,`entity_guid`) 72 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 73 | 74 | CREATE TABLE IF NOT EXISTS `recommendations_clustered_recs` ( 75 | `entity_guid` bigint DEFAULT NULL, 76 | `entity_owner_guid` bigint DEFAULT NULL, 77 | `cluster_id` int DEFAULT NULL, 78 | `score` float DEFAULT NULL, 79 | `total_views` int DEFAULT NULL, 80 | `total_engagement` int DEFAULT NULL, 81 | `first_engaged` datetime DEFAULT NULL, 82 | `last_engaged` datetime DEFAULT NULL, 83 | `last_updated` datetime DEFAULT NULL, 84 | `time_created` datetime DEFAULT NULL, 85 | KEY `idx_cluster_id` (`cluster_id`) 86 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 87 | 88 | CREATE TABLE IF NOT EXISTS `recommendations_clustered_recs_orig` ( 89 | `cluster_id` int NOT NULL, 90 | `entity_guid` bigint NOT NULL, 91 | `entity_owner_guid` bigint DEFAULT NULL, 92 | `score` float(5,2) DEFAULT NULL, 93 | `first_engaged` timestamp NULL DEFAULT NULL, 94 | `last_engaged` timestamp NULL DEFAULT NULL, 95 | `last_updated` timestamp NULL DEFAULT NULL, 96 | `time_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 97 | `total_views` bigint DEFAULT NULL, 98 | `total_engagement` bigint DEFAULT NULL, 99 | PRIMARY KEY (`cluster_id`,`entity_guid`), 100 | KEY `score` (`score`) 101 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 102 | 103 | CREATE TABLE IF NOT EXISTS `supermind_refunds` ( 104 | `supermind_request_guid` bigint NOT NULL, 105 | `tx_id` varchar(32) NOT NULL, 106 | `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 107 | PRIMARY KEY (`supermind_request_guid`) 108 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 109 | 110 | CREATE TABLE IF NOT EXISTS `superminds` ( 111 | `guid` bigint NOT NULL, 112 | `activity_guid` bigint DEFAULT NULL, 113 | `reply_activity_guid` bigint DEFAULT NULL, 114 | `sender_guid` bigint DEFAULT NULL, 115 | `receiver_guid` bigint DEFAULT NULL, 116 | `status` int DEFAULT NULL, 117 | `payment_amount` float(7,2) DEFAULT NULL, 118 | `payment_method` int DEFAULT NULL, 119 | `payment_reference` text, 120 | `created_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 121 | `updated_timestamp` timestamp NULL DEFAULT NULL, 122 | `twitter_required` tinyint(1) DEFAULT NULL, 123 | `reply_type` int DEFAULT NULL, 124 | PRIMARY KEY (`guid`), 125 | KEY `sender_guid` (`sender_guid`,`status`), 126 | KEY `receiver_guid` (`receiver_guid`,`status`) 127 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 128 | 129 | CREATE TABLE IF NOT EXISTS `user_configurations` ( 130 | `user_guid` bigint NOT NULL, 131 | `terms_accepted_at` timestamp NULL DEFAULT NULL, 132 | `supermind_cash_min` float(7,2) DEFAULT NULL, 133 | `supermind_offchain_tokens_min` float(7,2) DEFAULT NULL, 134 | `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 135 | `updated_at` timestamp NULL DEFAULT NULL, 136 | PRIMARY KEY (`user_guid`) 137 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 138 | -------------------------------------------------------------------------------- /containers/nginx/dev-ssr.conf.tpl: -------------------------------------------------------------------------------- 1 | map $http_upgrade $connection_upgrade { 2 | default upgrade; 3 | '' close; 4 | } 5 | 6 | server { 7 | resolver ${DOCKER_RESOLVER} ipv6=off; 8 | 9 | large_client_header_buffers 4 16k; 10 | 11 | listen 80; 12 | listen [::]:80 default ipv6only=on; 13 | listen 8080; 14 | 15 | index index.php index.html; 16 | server_name _; 17 | 18 | error_log /dev/stdout warn; 19 | access_log off; 20 | 21 | if ($host = 'minds.com' ) { 22 | rewrite ^/(.*)$ https://www.minds.com/$1 permanent; 23 | } 24 | 25 | #if ($http_x_forwarded_proto != "https") { 26 | # rewrite ^(.*)$ https://$host$REQUEST_URI permanent; 27 | #} 28 | 29 | sendfile off; 30 | 31 | root /var/www/Minds/front/dist/browser/$locale; 32 | 33 | # Do not cache by default 34 | set $no_cache 1; 35 | 36 | # Cache GET requests by default 37 | if ($request_method = GET){ 38 | set $no_cache 1; 39 | } 40 | 41 | # Do not cache if we have a cookie set 42 | if ($http_cookie ~ "(mindsperm)" ){ 43 | set $no_cache 1; 44 | } 45 | 46 | # Do not cache if we have a logged in cookie 47 | if ($cookie_minds_sess) { 48 | set $no_cache 1; 49 | } 50 | 51 | location @nossr { 52 | try_files /index.html =404; 53 | } 54 | 55 | if ($request_uri ~ /api/v3/friendly-captcha/puzzle) { 56 | set $no_cache 1; 57 | } 58 | 59 | location / { 60 | root /var/www/Minds/front/dist/browser/$locale; 61 | 62 | error_page 418 = @nossr; 63 | error_page 502 = @nossr; 64 | error_page 504 = @nossr; 65 | recursive_error_pages on; 66 | set $nossr 0; 67 | 68 | #if ($no_cache) { 69 | # set $nossr 1; 70 | #} 71 | 72 | if ($http_cookie ~* "nossr") { 73 | set $nossr 1; 74 | } 75 | 76 | if ($nossr = 1) { 77 | return 418; 78 | } 79 | 80 | set $upstream http://${UPSTREAM_ENDPOINT}; 81 | 82 | port_in_redirect off; 83 | 84 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 85 | proxy_set_header Host $http_host; 86 | proxy_set_header X-NginX-Proxy true; 87 | proxy_set_header X-Minds-Locale $locale; 88 | proxy_pass $upstream; 89 | proxy_redirect off; 90 | proxy_http_version 1.1; 91 | proxy_set_header Upgrade $http_upgrade; 92 | proxy_set_header Connection "upgrade"; 93 | proxy_set_header X-Forwarded-Proto $scheme; 94 | } 95 | 96 | # Dev mode uses the dist/browser location 97 | # Prod mode will proxy an s3 bucket (see minds.conf) 98 | location /static/ { 99 | alias /var/www/Minds/front/dist/browser/; 100 | expires 1y; 101 | log_not_found off; 102 | } 103 | 104 | location /embed-static/ { 105 | alias /var/www/Minds/front/dist/embed/; 106 | expires 1y; 107 | log_not_found off; 108 | } 109 | 110 | location /plugins/embedded-comments { 111 | alias /var/www/Minds/embedded-comments/build; 112 | index index.html; 113 | 114 | add_header 'Access-Control-Allow-Origin' "$http_origin"; 115 | add_header 'Access-Control-Allow-Credentials' 'true'; 116 | } 117 | 118 | location /plugins/embedded-boosts { 119 | alias /var/www/Minds/embedded-boosts/build; 120 | index index.html; 121 | 122 | add_header 'Access-Control-Allow-Origin' "$http_origin"; 123 | } 124 | 125 | location ^~ /api/sockets/ { 126 | set $upstream http://sockets:3000; 127 | 128 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 129 | proxy_set_header Host $http_host; 130 | 131 | proxy_pass $upstream; 132 | 133 | proxy_http_version 1.1; 134 | proxy_set_header Upgrade $http_upgrade; 135 | proxy_set_header Connection "upgrade"; 136 | } 137 | 138 | location ~ ^(/api|/fs|/icon|/carousel|/emails/unsubscribe|/.well-known|/manifest.webmanifest) { 139 | add_header 'Access-Control-Allow-Origin' "$http_origin"; 140 | add_header 'Access-Control-Allow-Credentials' 'true'; 141 | add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; 142 | add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With,X-No-Cache'; 143 | 144 | rewrite ^(.+)$ /index.php last; 145 | } 146 | 147 | # Not in block above as did.json is not in the root of the path 148 | location ~ (did.json) { 149 | rewrite ^(.+)$ /index.php last; 150 | } 151 | 152 | location ~* \.(woff|woff2|ttf|eot) { 153 | add_header 'Access-Control-Allow-Origin' *; 154 | } 155 | 156 | location ~ ^/(manifest.webmanifest|ngsw-worker.js|ngsw.json|safety-worker.js|worker-basic.min.js)$ { 157 | rewrite /var/www/Minds/front/dist/browser/en/$1 last; 158 | } 159 | 160 | location ~ (composer.json|composer.lock|.travis.yml){ 161 | deny all; 162 | } 163 | 164 | location @rewrite { 165 | rewrite ^(.+)$ /index.php last; 166 | } 167 | 168 | # pass the PHP scripts to FastCGI server listening on socket 169 | location ~ \.php$ { 170 | add_header X-Cache $upstream_cache_status; 171 | add_header No-Cache $no_cache; 172 | add_header X-No-Cache $no_cache; 173 | 174 | fastcgi_cache fastcgicache; 175 | fastcgi_cache_bypass $no_cache; 176 | fastcgi_no_cache $no_cache; 177 | 178 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 179 | fastcgi_pass php-fpm:9000; 180 | fastcgi_index index.php; 181 | 182 | fastcgi_buffers 64 32k; 183 | fastcgi_buffer_size 64k; 184 | 185 | include fastcgi_params; 186 | fastcgi_param SCRIPT_FILENAME /var/www/Minds/engine/index.php; 187 | fastcgi_param PATH_INFO $fastcgi_path_info; 188 | } 189 | 190 | location ~ /\. { 191 | log_not_found off; 192 | deny all; 193 | } 194 | 195 | } 196 | -------------------------------------------------------------------------------- /bin/bootstrap-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | php_version="7.0" 4 | php_conf="/etc/php/$php_version/fpm/php.ini" 5 | fpm_conf="/etc/php/$php_version/fpm/pool.d/www.conf" 6 | cassandra_version="3.0.9" 7 | cassandra_so="/usr/lib/php/20151012/cassandra.so" 8 | 9 | add-apt-repository -y ppa:ondrej/php 10 | add-apt-repository -y ppa:openjdk-r/ppa 11 | echo "deb http://debian.datastax.com/community stable main" > /etc/apt/sources.list.d/cassandra.sources.list 12 | curl -sS -L http://debian.datastax.com/debian/repo_key | sudo apt-key add - 13 | 14 | apt-get update 15 | apt-get install -y \ 16 | nginx \ 17 | wget \ 18 | openssh-client \ 19 | curl \ 20 | git \ 21 | php$php_version \ 22 | php$php_version-dev \ 23 | php$php_version-bcmath \ 24 | php$php_version-common \ 25 | php$php_version-ctype \ 26 | php$php_version-fpm \ 27 | php$php_version-mbstring \ 28 | php$php_version-mcrypt \ 29 | php$php_version-pdo \ 30 | cassandra=$cassandra_version cassandra-tools=$cassandra_version \ 31 | openjdk-8-jre \ 32 | rabbitmq-server \ 33 | openssl \ 34 | php$php_version-gd \ 35 | php$php_version-xml \ 36 | php$php_version-curl \ 37 | php$php_version-json \ 38 | php$php_version-zip 39 | 40 | # Setup nginx configs 41 | rm -rf /etc/nginx/sites-enabled/default 42 | cp -f /var/www/Minds/conf/nginx-site.conf /etc/nginx/sites-enabled/minds.conf 43 | cp -f /var/www/Minds/conf/nginx.conf /etc/nginx/nginx.conf 44 | 45 | # Tweak PHP configs 46 | 47 | sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" ${php_conf} && \ 48 | sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" ${php_conf} && \ 49 | sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" ${php_conf} && \ 50 | sed -i -e "s/variables_order = \"GPCS\"/variables_order = \"EGPCS\"/g" ${php_conf} && \ 51 | sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" ${fpm_conf} && \ 52 | sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" ${fpm_conf} && \ 53 | sed -i -e "s/pm.max_children = 4/pm.max_children = 4/g" ${fpm_conf} && \ 54 | sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" ${fpm_conf} && \ 55 | sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" ${fpm_conf} && \ 56 | sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" ${fpm_conf} && \ 57 | sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" ${fpm_conf} && \ 58 | sed -i -e "s/user = nobody/user = nginx/g" ${fpm_conf} && \ 59 | sed -i -e "s/group = nobody/group = nginx/g" ${fpm_conf} && \ 60 | sed -i -e "s/;listen.mode = 0660/listen.mode = 0666/g" ${fpm_conf} && \ 61 | sed -i -e "s/;listen.owner = nobody/listen.owner = nginx/g" ${fpm_conf} && \ 62 | sed -i -e "s/;listen.group = nobody/listen.group = nginx/g" ${fpm_conf} && \ 63 | sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm7.sock/g" ${fpm_conf} 64 | 65 | # Cassandra options 66 | 67 | sed -i "s/^listen_address:.*/listen_address: 127.0.0.1/" /etc/cassandra/cassandra.yaml 68 | sed -i "s/^\(\s*\)- seeds:.*/\1- seeds: 127.0.0.1/" /etc/cassandra/cassandra.yaml 69 | sed -i "s/^rpc_address:.*/rpc_address: 0.0.0.0/" /etc/cassandra/cassandra.yaml 70 | sed -i "s/^# broadcast_address:.*/broadcast_address: 127.0.0.1/" /etc/cassandra/cassandra.yaml 71 | sed -i "s/^# broadcast_rpc_address:.*/broadcast_rpc_address: 127.0.0.1/" /etc/cassandra/cassandra.yaml 72 | sed -i 's/^start_rpc.*$/start_rpc: true/' /etc/cassandra/cassandra.yaml 73 | 74 | # Setup cassandra driver 75 | apt-get install -y php$php_version-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl 76 | if [ ! -f $cassandra_so ]; then 77 | wget -nv http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb 78 | wget -nv http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb 79 | wget -nv http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver_2.4.2-1_amd64.deb 80 | wget -nv http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver-dev_2.4.2-1_amd64.deb 81 | dpkg -i libuv_1.8.0-1_amd64.deb 82 | dpkg -i libuv-dev_1.8.0-1_amd64.deb 83 | dpkg -i cassandra-cpp-driver_2.4.2-1_amd64.deb 84 | dpkg -i cassandra-cpp-driver-dev_2.4.2-1_amd64.deb 85 | fi 86 | pecl install cassandra-1.2.2 87 | echo "extension=cassandra.so" > /etc/php/$php_version/mods-available/cassandra.ini 88 | phpenmod cassandra 89 | 90 | # Setup Mongo driver 91 | apt-get install -y mongodb php$php_version-mongodb 92 | phpenmod mongodb 93 | 94 | # Setup Redis driver 95 | apt-get install -y redis-server php$php_version-redis 96 | phpenmod redis 97 | 98 | # start services 99 | service nginx restart 100 | service php$php_version-fpm restart 101 | service cassandra restart 102 | service mongodb restart 103 | service redis-server restart 104 | 105 | # Install NodeJS 106 | if ! dpkg --compare-versions `node --version | sed 's/^.//'` ge '6.0'; then 107 | curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 108 | sudo apt-get install -y nodejs build-essential 109 | fi 110 | npm install -g npm typescript ts-node 111 | 112 | # Install Composer 113 | if [ -f /usr/local/bin/composer ]; then 114 | composer self-update 115 | else 116 | wget -nv -O composer-setup.php https://getcomposer.org/installer 117 | php composer-setup.php --install-dir=/usr/local/bin --filename=composer 118 | rm composer-setup.php 119 | fi 120 | 121 | cd /var/www/Minds/engine 122 | composer install 123 | cd - 124 | 125 | # Additional folders 126 | mkdir --parents --mode=0777 /tmp/minds-cache/ 127 | mkdir --parents --mode=0777 /data/ 128 | 129 | cd /var/www/Minds 130 | 131 | if [ -f "/var/www/Minds/engine/settings.php" ]; then 132 | echo "Provisioning Minds…" 133 | 134 | php ./bin/cli.php install \ 135 | --use-existing-settings \ 136 | --graceful-storage-provision \ 137 | --username=minds \ 138 | --password=password \ 139 | --email=minds@dev.minds.io 140 | else 141 | echo "Installing Minds…" 142 | 143 | php ./bin/regenerateDevKeys.php; 144 | 145 | php ./bin/cli.php install \ 146 | --graceful-storage-provision \ 147 | --domain=dev.minds.io \ 148 | --username=minds \ 149 | --password=password \ 150 | --email=minds@dev.minds.io \ 151 | --private-key=/var/www/Minds/.dev/minds.pem \ 152 | --public-key=/var/www/Minds/.dev/minds.pub 153 | fi 154 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Main docker-compose 2 | # Suited for containerized SSR server. 3 | version: "2.2" 4 | 5 | services: 6 | 7 | ## WEB SERVER / GATEWAY 8 | 9 | nginx: 10 | build: 11 | context: ./containers/nginx 12 | dockerfile: ./Dockerfile.dev-ssr 13 | mem_limit: 512MB 14 | depends_on: 15 | - php-fpm 16 | - php-rr 17 | networks: 18 | - app 19 | ports: 20 | - "8080:80" 21 | environment: 22 | - UPSTREAM_ENDPOINT 23 | volumes: 24 | - ./front/:/var/www/Minds/front:cached 25 | - ./embedded-comments/:/var/www/Minds/embedded-comments 26 | - ./embedded-boosts/:/var/www/Minds/embedded-boosts 27 | 28 | ## APP ENGINE 29 | 30 | php-fpm: 31 | build: 32 | context: ./engine 33 | dockerfile: ./containers/php-fpm/Dockerfile.dev 34 | mem_limit: 512MB 35 | depends_on: 36 | - cassandra 37 | - elasticsearch 38 | - redis 39 | - pulsar 40 | - mysql 41 | networks: 42 | - app 43 | volumes: 44 | - ./front/:/var/www/Minds/front:cached 45 | - ./engine/:/var/www/Minds/engine:cached 46 | - keys:/.dev 47 | 48 | php-rr: 49 | build: 50 | context: ./engine 51 | dockerfile: ./containers/php-rr/Dockerfile.dev 52 | mem_limit: 512MB 53 | depends_on: 54 | - cassandra 55 | - elasticsearch 56 | - redis 57 | - pulsar 58 | - mysql 59 | networks: 60 | - app 61 | ports: 62 | - "9001:9001" 63 | - "2112:2112" 64 | volumes: 65 | - ./engine/:/var/www/Minds/engine:cached 66 | - keys:/.dev 67 | 68 | runners: 69 | build: 70 | context: ./engine 71 | dockerfile: ./containers/php-runners/Dockerfile 72 | depends_on: 73 | - cassandra 74 | - elasticsearch 75 | - redis 76 | networks: 77 | - app 78 | volumes: 79 | - ./front/:/var/www/Minds/front:cached 80 | - ./engine/:/var/www/Minds/engine:cached 81 | - keys:/.dev 82 | 83 | sockets: 84 | build: 85 | context: ./sockets 86 | dockerfile: ./Dockerfile 87 | environment: 88 | - PORT=3000 89 | - REDIS_HOST=redis 90 | - REDIS_PORT=6379 91 | - JWT_SECRET= 92 | - CASSANDRA_SERVERS=cassandra 93 | - CASSANDRA_KEYSPACE=minds 94 | networks: 95 | - app 96 | depends_on: 97 | - redis 98 | - cassandra 99 | volumes: 100 | - keys:/.dev 101 | ports: 102 | - 3000:3000 103 | 104 | ## Vault 105 | 106 | vault: 107 | image: hashicorp/vault 108 | networks: 109 | - app 110 | environment: 111 | VAULT_ADDR: "http://0.0.0.0:8200" 112 | VAULT_API_ADDR: "http://0.0.0.0:8200" 113 | cap_add: 114 | - IPC_LOCK 115 | ports: 116 | - 8200:8200 117 | volumes: 118 | - vault:/vault/file:rw 119 | entrypoint: vault server -dev -dev-listen-address="0.0.0.0:8200" -dev-root-token-id="root" 120 | 121 | ## DATABASES 122 | 123 | cassandra: 124 | build: 125 | context: ./containers/cassandra 126 | environment: 127 | - CASSANDRA_START_RPC=true 128 | - MAX_HEAP_SIZE=768M 129 | - HEAP_NEWSIZE=512M 130 | networks: 131 | - app 132 | mem_limit: 1024MB 133 | volumes: 134 | - cassandra-data:/var/lib/cassandra 135 | ports: 136 | - 9042:9042 137 | healthcheck: 138 | test: "cqlsh -e 'DESC TABLE system.batches'" 139 | retries: 10 140 | timeout: 5s 141 | interval: 15s 142 | 143 | wait-for-cassandra: 144 | build: 145 | context: ./containers/wait-for-cassandra 146 | networks: 147 | - app 148 | depends_on: 149 | - cassandra 150 | 151 | elasticsearch: 152 | image: opensearchproject/opensearch:2.17.1 153 | mem_limit: 1G # keep an eye 154 | ulimits: 155 | nproc: 65536 156 | memlock: 157 | soft: 65536 158 | hard: 65536 159 | nofile: 160 | soft: 65536 161 | hard: 65536 162 | environment: 163 | - "ES_JAVA_OPTS=-Xms726m -Xmx726m" 164 | - discovery.type=single-node 165 | - DISABLE_INSTALL_DEMO_CONFIG=true 166 | - plugins.security.disabled=true 167 | - cluster.routing.allocation.disk.watermark.low=95% 168 | - cluster.routing.allocation.disk.watermark.high=99% 169 | - cluster.routing.allocation.disk.watermark.flood_stage=99% 170 | networks: 171 | - app 172 | ports: 173 | - "9200:9200" 174 | volumes: 175 | - opendistro-data:/usr/share/opensearch/data 176 | 177 | ## CACHE 178 | 179 | redis: 180 | image: redis:6.2.7-alpine 181 | mem_limit: 100MB # keep an eye 182 | networks: 183 | - app 184 | ports: 185 | - "6379:6379" 186 | 187 | ## INSTALLATION ARTIFACTS 188 | 189 | installer: 190 | build: 191 | context: ./engine 192 | dockerfile: ./containers/installer/Dockerfile 193 | networks: 194 | - app 195 | volumes: 196 | - ./front/:/var/www/Minds/front:delegated 197 | - ./engine/:/var/www/Minds/engine:delegated 198 | - keys:/.dev 199 | depends_on: 200 | cassandra: 201 | condition: service_healthy 202 | 203 | elasticsearch-provisioner: 204 | build: 205 | context: ./containers/elasticsearch-provisioner 206 | networks: 207 | - app 208 | depends_on: 209 | - elasticsearch 210 | 211 | ## Pulsar 212 | 213 | pulsar: 214 | image: apachepulsar/pulsar:2.11.2 215 | entrypoint: bin/pulsar standalone -nss 216 | networks: 217 | - app 218 | ports: 219 | - 6650:6650 220 | - 8088:8080 221 | volumes: 222 | - pulsardata:/pulsar/data 223 | - pulsarconf:/pulsar/conf 224 | 225 | ## MySQL 226 | 227 | mysql: 228 | image: mysql:8.0 229 | networks: 230 | - app 231 | ports: 232 | - 3306:3306 233 | environment: 234 | MYSQL_ALLOW_EMPTY_PASSWORD: "true" 235 | MYSQL_USER: "user" 236 | MYSQL_PASSWORD: "changeme" 237 | MYSQL_DATABASE: "minds" 238 | volumes: 239 | - mysql:/var/lib/mysql 240 | 241 | mysql-provisioner: 242 | build: 243 | context: ./containers/mysql-provisioner 244 | networks: 245 | - app 246 | depends_on: 247 | - mysql 248 | 249 | ## METASCRAPER SERVER 250 | 251 | metascraper: 252 | image: registry.gitlab.com/minds/developers/metascraper-server 253 | mem_limit: 512MB 254 | networks: 255 | - app 256 | ports: 257 | - "3334:3334" 258 | 259 | ## UTILITIES 260 | 261 | kibana: 262 | image: docker.elastic.co/kibana/kibana-oss:6.6.2 263 | depends_on: 264 | - elasticsearch 265 | environment: 266 | ELASTICSEARCH_URL: http://minds_elasticsearch_1:9200 267 | networks: 268 | - app 269 | ports: 270 | - "5601:5601" 271 | 272 | volumes: 273 | cassandra-data: 274 | elasticsearch-data: 275 | opendistro-data: 276 | keys: 277 | pulsardata: 278 | pulsarconf: 279 | mysql: 280 | vault: 281 | 282 | networks: 283 | app: 284 | driver: "bridge" 285 | -------------------------------------------------------------------------------- /containers/nginx/minds.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80 default ipv6only=on; 4 | 5 | index index.html; 6 | server_name _; 7 | 8 | error_log /dev/stdout warn; 9 | access_log /dev/stdout main; 10 | 11 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; 12 | add_header X-Frame-Options "SAMEORIGIN"; 13 | 14 | # Do not cache by default 15 | set $no_cache 1; 16 | 17 | # Cache GET requests by default 18 | if ($request_method = GET){ 19 | set $no_cache 0; 20 | } 21 | 22 | # Do not cache if we have a cookie set 23 | if ($http_cookie ~ "(mindsperm)" ){ 24 | set $no_cache 1; 25 | } 26 | 27 | # Do not cache if we have a logged in cookie 28 | if ($cookie_minds_sess) { 29 | set $no_cache 1; 30 | } 31 | 32 | if ($request_uri ~ /api/v3/friendly-captcha/puzzle) { 33 | set $no_cache 1; 34 | } 35 | 36 | if ($http_x_forwarded_proto != "https") { 37 | rewrite ^/(.*)$ https://$host$REQUEST_URI permanent; 38 | } 39 | 40 | if ($host = 'minds.com' ) { 41 | rewrite ^/(.*)$ https://www.minds.com/$1 permanent; 42 | } 43 | 44 | set $is_cdn 0; 45 | 46 | if ($http_X_Amz_Cf_Id) { 47 | set $is_cdn 1; 48 | } 49 | 50 | root /dist/browser/$locale; 51 | 52 | # Register this before HTTP redirect 53 | location /--health-check { 54 | rewrite /health / last; 55 | } 56 | 57 | sendfile off; 58 | 59 | location /favicon.ico { 60 | return 404; 61 | } 62 | 63 | location @nossr { 64 | try_files /index.html =404; 65 | 66 | add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; 67 | if_modified_since off; 68 | expires off; 69 | etag off; 70 | } 71 | 72 | location /embed/ { 73 | add_header 'Access-Control-Allow-Origin' *; 74 | add_header X-Frame-Options ""; 75 | add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; 76 | 77 | rewrite ^(.+)$ /embed-static/en/embed.html last; 78 | } 79 | 80 | location / { 81 | if ($is_cdn) { 82 | return 301 https://www.minds.com$request_uri; 83 | } 84 | 85 | error_page 418 = @nossr; 86 | error_page 502 = @nossr; 87 | error_page 504 = @nossr; 88 | recursive_error_pages on; 89 | set $nossr 0; 90 | 91 | if ($no_cache) { 92 | set $nossr 1; 93 | } 94 | 95 | if ($http_cookie ~* "nossr") { 96 | set $nossr 1; 97 | } 98 | 99 | if ($nossr = 1) { 100 | return 418; 101 | } 102 | 103 | port_in_redirect off; 104 | 105 | ## Cache logged out pages 106 | # add_header X-Cache $upstream_cache_status; 107 | # proxy_cache node_cache; 108 | # proxy_cache_bypass $no_cache; 109 | # proxy_no_cache $no_cache; 110 | 111 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 112 | proxy_set_header Host $http_host; 113 | proxy_set_header X-NginX-Proxy true; 114 | proxy_set_header X-Minds-Locale $locale; 115 | proxy_pass http://front:4200; 116 | proxy_redirect off; 117 | proxy_http_version 1.1; 118 | proxy_set_header Upgrade $http_upgrade; 119 | proxy_set_header Connection "upgrade"; 120 | proxy_redirect off; 121 | proxy_set_header X-Forwarded-Proto $scheme; 122 | proxy_read_timeout 5s; # Longer than 5 seconds then go back to nossr 123 | } 124 | 125 | location ~ ^(/api/|/fs/|/icon|/carousel|/checkout|/oauth2|/archive/thumbnail|/apple-app-site-association|/emails/unsubscribe) { 126 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; 127 | add_header 'Access-Control-Allow-Origin' "$http_origin"; 128 | add_header 'Access-Control-Allow-Credentials' 'true'; 129 | add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; 130 | add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With,X-No-Cache,X-Robots-Tag'; 131 | 132 | rewrite ^(.+)$ /index.php last; 133 | } 134 | 135 | # Prod mode will proxy an s3 bucket 136 | # Dev mode uses the dist/browser location (see dev-srr.conf.tpl) 137 | location /static/ { 138 | expires 1y; 139 | log_not_found off; 140 | 141 | add_header 'Access-Control-Allow-Origin' *; 142 | 143 | proxy_http_version 1.1; 144 | proxy_set_header Host cdn-assets.minds.com; 145 | proxy_intercept_errors on; 146 | proxy_ssl_verify off; 147 | proxy_ssl_server_name on; 148 | #proxy_ssl off; 149 | proxy_pass https://cdn-assets.minds.com/front/dist/browser/; 150 | proxy_redirect off; 151 | } 152 | 153 | location /embed-static/ { 154 | expires 1y; 155 | log_not_found off; 156 | 157 | add_header 'Access-Control-Allow-Origin' *; 158 | 159 | proxy_http_version 1.1; 160 | proxy_set_header Host cdn-assets.minds.com; 161 | proxy_intercept_errors on; 162 | proxy_ssl_verify off; 163 | proxy_ssl_server_name on; 164 | #proxy_ssl off; 165 | proxy_pass https://cdn-assets.minds.com/front/dist/embed/; 166 | proxy_redirect off; 167 | } 168 | 169 | location /robots.txt { 170 | if ($host != 'www.minds.com') { 171 | return 200 "User-agent: *\nDisallow: /\n"; 172 | } 173 | 174 | rewrite ^(.+)$ /sitemaps/robots.txt last; 175 | } 176 | 177 | location /sitemap.xml { 178 | rewrite ^(.+)$ /sitemaps/sitemap.xml last; 179 | } 180 | 181 | location /sitemaps { 182 | proxy_http_version 1.1; 183 | proxy_set_header Host minds-sitemaps.s3.us-east-1.amazonaws.com; 184 | proxy_intercept_errors on; 185 | proxy_pass http://minds-sitemaps.s3.us-east-1.amazonaws.com/minds.com; 186 | } 187 | 188 | location ~ (composer.json|composer.lock|.travis.yml){ 189 | deny all; 190 | } 191 | 192 | # location @rewrite { 193 | # rewrite ^(.+)$ /index.php last; 194 | # } 195 | 196 | # pass the PHP scripts to FastCGI server listening on socket 197 | location ~ \.php$ { 198 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; 199 | add_header X-Cache $upstream_cache_status; 200 | add_header No-Cache $no_cache; 201 | add_header X-No-Cache $no_cache; 202 | add_header X-Robots-Tag "noindex"; 203 | 204 | fastcgi_cache fastcgicache; 205 | fastcgi_cache_bypass $no_cache; 206 | fastcgi_no_cache $no_cache; 207 | 208 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 209 | fastcgi_pass php-fpm:9000; 210 | fastcgi_index index.php; 211 | 212 | fastcgi_buffers 64 32k; 213 | fastcgi_buffer_size 64k; 214 | 215 | fastcgi_max_temp_file_size 0; 216 | 217 | include fastcgi_params; 218 | fastcgi_param SCRIPT_FILENAME /var/www/Minds/engine/index.php; 219 | fastcgi_param PATH_INFO $fastcgi_path_info; 220 | fastcgi_param HTTP_AUTHORIZATION $http_authorization; 221 | } 222 | 223 | location ~ /\. { 224 | log_not_found off; 225 | deny all; 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | UNLESS OTHERWISE STATED, ALL SUBMODULES AND PLUGINS ARE LICENSED UNDER THE AGPLv3 LICENSE. 2 | 3 | GNU AFFERO GENERAL PUBLIC LICENSE 4 | Version 3, 19 November 2007 5 | 6 | Copyright (C) 2007 Free Software Foundation, Inc. 7 | Everyone is permitted to copy and distribute verbatim copies 8 | of this license document, but changing it is not allowed. 9 | 10 | Preamble 11 | 12 | The GNU Affero General Public License is a free, copyleft license for 13 | software and other kinds of works, specifically designed to ensure 14 | cooperation with the community in the case of network server software. 15 | 16 | The licenses for most software and other practical works are designed 17 | to take away your freedom to share and change the works. By contrast, 18 | our General Public Licenses are intended to guarantee your freedom to 19 | share and change all versions of a program--to make sure it remains free 20 | software for all its users. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | Developers that use our General Public Licenses protect your rights 30 | with two steps: (1) assert copyright on the software, and (2) offer 31 | you this License which gives you legal permission to copy, distribute 32 | and/or modify the software. 33 | 34 | A secondary benefit of defending all users' freedom is that 35 | improvements made in alternate versions of the program, if they 36 | receive widespread use, become available for other developers to 37 | incorporate. Many developers of free software are heartened and 38 | encouraged by the resulting cooperation. However, in the case of 39 | software used on network servers, this result may fail to come about. 40 | The GNU General Public License permits making a modified version and 41 | letting the public access it on a server without ever releasing its 42 | source code to the public. 43 | 44 | The GNU Affero General Public License is designed specifically to 45 | ensure that, in such cases, the modified source code becomes available 46 | to the community. It requires the operator of a network server to 47 | provide the source code of the modified version running there to the 48 | users of that server. Therefore, public use of a modified version, on 49 | a publicly accessible server, gives the public access to the source 50 | code of the modified version. 51 | 52 | An older license, called the Affero General Public License and 53 | published by Affero, was designed to accomplish similar goals. This is 54 | a different license, not a version of the Affero GPL, but Affero has 55 | released a new version of the Affero GPL which permits relicensing under 56 | this license. 57 | 58 | The precise terms and conditions for copying, distribution and 59 | modification follow. 60 | 61 | TERMS AND CONDITIONS 62 | 63 | 0. Definitions. 64 | 65 | "This License" refers to version 3 of the GNU Affero General Public License. 66 | 67 | "Copyright" also means copyright-like laws that apply to other kinds of 68 | works, such as semiconductor masks. 69 | 70 | "The Program" refers to any copyrightable work licensed under this 71 | License. Each licensee is addressed as "you". "Licensees" and 72 | "recipients" may be individuals or organizations. 73 | 74 | To "modify" a work means to copy from or adapt all or part of the work 75 | in a fashion requiring copyright permission, other than the making of an 76 | exact copy. The resulting work is called a "modified version" of the 77 | earlier work or a work "based on" the earlier work. 78 | 79 | A "covered work" means either the unmodified Program or a work based 80 | on the Program. 81 | 82 | To "propagate" a work means to do anything with it that, without 83 | permission, would make you directly or secondarily liable for 84 | infringement under applicable copyright law, except executing it on a 85 | computer or modifying a private copy. Propagation includes copying, 86 | distribution (with or without modification), making available to the 87 | public, and in some countries other activities as well. 88 | 89 | To "convey" a work means any kind of propagation that enables other 90 | parties to make or receive copies. Mere interaction with a user through 91 | a computer network, with no transfer of a copy, is not conveying. 92 | 93 | An interactive user interface displays "Appropriate Legal Notices" 94 | to the extent that it includes a convenient and prominently visible 95 | feature that (1) displays an appropriate copyright notice, and (2) 96 | tells the user that there is no warranty for the work (except to the 97 | extent that warranties are provided), that licensees may convey the 98 | work under this License, and how to view a copy of this License. If 99 | the interface presents a list of user commands or options, such as a 100 | menu, a prominent item in the list meets this criterion. 101 | 102 | 1. Source Code. 103 | 104 | The "source code" for a work means the preferred form of the work 105 | for making modifications to it. "Object code" means any non-source 106 | form of a work. 107 | 108 | A "Standard Interface" means an interface that either is an official 109 | standard defined by a recognized standards body, or, in the case of 110 | interfaces specified for a particular programming language, one that 111 | is widely used among developers working in that language. 112 | 113 | The "System Libraries" of an executable work include anything, other 114 | than the work as a whole, that (a) is included in the normal form of 115 | packaging a Major Component, but which is not part of that Major 116 | Component, and (b) serves only to enable use of the work with that 117 | Major Component, or to implement a Standard Interface for which an 118 | implementation is available to the public in source code form. A 119 | "Major Component", in this context, means a major essential component 120 | (kernel, window system, and so on) of the specific operating system 121 | (if any) on which the executable work runs, or a compiler used to 122 | produce the work, or an object code interpreter used to run it. 123 | 124 | The "Corresponding Source" for a work in object code form means all 125 | the source code needed to generate, install, and (for an executable 126 | work) run the object code and to modify the work, including scripts to 127 | control those activities. However, it does not include the work's 128 | System Libraries, or general-purpose tools or generally available free 129 | programs which are used unmodified in performing those activities but 130 | which are not part of the work. For example, Corresponding Source 131 | includes interface definition files associated with source files for 132 | the work, and the source code for shared libraries and dynamically 133 | linked subprograms that the work is specifically designed to require, 134 | such as by intimate data communication or control flow between those 135 | subprograms and other parts of the work. 136 | 137 | The Corresponding Source need not include anything that users 138 | can regenerate automatically from other parts of the Corresponding 139 | Source. 140 | 141 | The Corresponding Source for a work in source code form is that 142 | same work. 143 | 144 | 2. Basic Permissions. 145 | 146 | All rights granted under this License are granted for the term of 147 | copyright on the Program, and are irrevocable provided the stated 148 | conditions are met. This License explicitly affirms your unlimited 149 | permission to run the unmodified Program. The output from running a 150 | covered work is covered by this License only if the output, given its 151 | content, constitutes a covered work. This License acknowledges your 152 | rights of fair use or other equivalent, as provided by copyright law. 153 | 154 | You may make, run and propagate covered works that you do not 155 | convey, without conditions so long as your license otherwise remains 156 | in force. You may convey covered works to others for the sole purpose 157 | of having them make modifications exclusively for you, or provide you 158 | with facilities for running those works, provided that you comply with 159 | the terms of this License in conveying all material for which you do 160 | not control copyright. Those thus making or running the covered works 161 | for you must do so exclusively on your behalf, under your direction 162 | and control, on terms that prohibit them from making any copies of 163 | your copyrighted material outside their relationship with you. 164 | 165 | Conveying under any other circumstances is permitted solely under 166 | the conditions stated below. Sublicensing is not allowed; section 10 167 | makes it unnecessary. 168 | 169 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 170 | 171 | No covered work shall be deemed part of an effective technological 172 | measure under any applicable law fulfilling obligations under article 173 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 174 | similar laws prohibiting or restricting circumvention of such 175 | measures. 176 | 177 | When you convey a covered work, you waive any legal power to forbid 178 | circumvention of technological measures to the extent such circumvention 179 | is effected by exercising rights under this License with respect to 180 | the covered work, and you disclaim any intention to limit operation or 181 | modification of the work as a means of enforcing, against the work's 182 | users, your or third parties' legal rights to forbid circumvention of 183 | technological measures. 184 | 185 | 4. Conveying Verbatim Copies. 186 | 187 | You may convey verbatim copies of the Program's source code as you 188 | receive it, in any medium, provided that you conspicuously and 189 | appropriately publish on each copy an appropriate copyright notice; 190 | keep intact all notices stating that this License and any 191 | non-permissive terms added in accord with section 7 apply to the code; 192 | keep intact all notices of the absence of any warranty; and give all 193 | recipients a copy of this License along with the Program. 194 | 195 | You may charge any price or no price for each copy that you convey, 196 | and you may offer support or warranty protection for a fee. 197 | 198 | 5. Conveying Modified Source Versions. 199 | 200 | You may convey a work based on the Program, or the modifications to 201 | produce it from the Program, in the form of source code under the 202 | terms of section 4, provided that you also meet all of these conditions: 203 | 204 | a) The work must carry prominent notices stating that you modified 205 | it, and giving a relevant date. 206 | 207 | b) The work must carry prominent notices stating that it is 208 | released under this License and any conditions added under section 209 | 7. This requirement modifies the requirement in section 4 to 210 | "keep intact all notices". 211 | 212 | c) You must license the entire work, as a whole, under this 213 | License to anyone who comes into possession of a copy. This 214 | License will therefore apply, along with any applicable section 7 215 | additional terms, to the whole of the work, and all its parts, 216 | regardless of how they are packaged. This License gives no 217 | permission to license the work in any other way, but it does not 218 | invalidate such permission if you have separately received it. 219 | 220 | d) If the work has interactive user interfaces, each must display 221 | Appropriate Legal Notices; however, if the Program has interactive 222 | interfaces that do not display Appropriate Legal Notices, your 223 | work need not make them do so. 224 | 225 | A compilation of a covered work with other separate and independent 226 | works, which are not by their nature extensions of the covered work, 227 | and which are not combined with it such as to form a larger program, 228 | in or on a volume of a storage or distribution medium, is called an 229 | "aggregate" if the compilation and its resulting copyright are not 230 | used to limit the access or legal rights of the compilation's users 231 | beyond what the individual works permit. Inclusion of a covered work 232 | in an aggregate does not cause this License to apply to the other 233 | parts of the aggregate. 234 | 235 | 6. Conveying Non-Source Forms. 236 | 237 | You may convey a covered work in object code form under the terms 238 | of sections 4 and 5, provided that you also convey the 239 | machine-readable Corresponding Source under the terms of this License, 240 | in one of these ways: 241 | 242 | a) Convey the object code in, or embodied in, a physical product 243 | (including a physical distribution medium), accompanied by the 244 | Corresponding Source fixed on a durable physical medium 245 | customarily used for software interchange. 246 | 247 | b) Convey the object code in, or embodied in, a physical product 248 | (including a physical distribution medium), accompanied by a 249 | written offer, valid for at least three years and valid for as 250 | long as you offer spare parts or customer support for that product 251 | model, to give anyone who possesses the object code either (1) a 252 | copy of the Corresponding Source for all the software in the 253 | product that is covered by this License, on a durable physical 254 | medium customarily used for software interchange, for a price no 255 | more than your reasonable cost of physically performing this 256 | conveying of source, or (2) access to copy the 257 | Corresponding Source from a network server at no charge. 258 | 259 | c) Convey individual copies of the object code with a copy of the 260 | written offer to provide the Corresponding Source. This 261 | alternative is allowed only occasionally and noncommercially, and 262 | only if you received the object code with such an offer, in accord 263 | with subsection 6b. 264 | 265 | d) Convey the object code by offering access from a designated 266 | place (gratis or for a charge), and offer equivalent access to the 267 | Corresponding Source in the same way through the same place at no 268 | further charge. You need not require recipients to copy the 269 | Corresponding Source along with the object code. If the place to 270 | copy the object code is a network server, the Corresponding Source 271 | may be on a different server (operated by you or a third party) 272 | that supports equivalent copying facilities, provided you maintain 273 | clear directions next to the object code saying where to find the 274 | Corresponding Source. Regardless of what server hosts the 275 | Corresponding Source, you remain obligated to ensure that it is 276 | available for as long as needed to satisfy these requirements. 277 | 278 | e) Convey the object code using peer-to-peer transmission, provided 279 | you inform other peers where the object code and Corresponding 280 | Source of the work are being offered to the general public at no 281 | charge under subsection 6d. 282 | 283 | A separable portion of the object code, whose source code is excluded 284 | from the Corresponding Source as a System Library, need not be 285 | included in conveying the object code work. 286 | 287 | A "User Product" is either (1) a "consumer product", which means any 288 | tangible personal property which is normally used for personal, family, 289 | or household purposes, or (2) anything designed or sold for incorporation 290 | into a dwelling. In determining whether a product is a consumer product, 291 | doubtful cases shall be resolved in favor of coverage. For a particular 292 | product received by a particular user, "normally used" refers to a 293 | typical or common use of that class of product, regardless of the status 294 | of the particular user or of the way in which the particular user 295 | actually uses, or expects or is expected to use, the product. A product 296 | is a consumer product regardless of whether the product has substantial 297 | commercial, industrial or non-consumer uses, unless such uses represent 298 | the only significant mode of use of the product. 299 | 300 | "Installation Information" for a User Product means any methods, 301 | procedures, authorization keys, or other information required to install 302 | and execute modified versions of a covered work in that User Product from 303 | a modified version of its Corresponding Source. The information must 304 | suffice to ensure that the continued functioning of the modified object 305 | code is in no case prevented or interfered with solely because 306 | modification has been made. 307 | 308 | If you convey an object code work under this section in, or with, or 309 | specifically for use in, a User Product, and the conveying occurs as 310 | part of a transaction in which the right of possession and use of the 311 | User Product is transferred to the recipient in perpetuity or for a 312 | fixed term (regardless of how the transaction is characterized), the 313 | Corresponding Source conveyed under this section must be accompanied 314 | by the Installation Information. But this requirement does not apply 315 | if neither you nor any third party retains the ability to install 316 | modified object code on the User Product (for example, the work has 317 | been installed in ROM). 318 | 319 | The requirement to provide Installation Information does not include a 320 | requirement to continue to provide support service, warranty, or updates 321 | for a work that has been modified or installed by the recipient, or for 322 | the User Product in which it has been modified or installed. Access to a 323 | network may be denied when the modification itself materially and 324 | adversely affects the operation of the network or violates the rules and 325 | protocols for communication across the network. 326 | 327 | Corresponding Source conveyed, and Installation Information provided, 328 | in accord with this section must be in a format that is publicly 329 | documented (and with an implementation available to the public in 330 | source code form), and must require no special password or key for 331 | unpacking, reading or copying. 332 | 333 | 7. Additional Terms. 334 | 335 | "Additional permissions" are terms that supplement the terms of this 336 | License by making exceptions from one or more of its conditions. 337 | Additional permissions that are applicable to the entire Program shall 338 | be treated as though they were included in this License, to the extent 339 | that they are valid under applicable law. If additional permissions 340 | apply only to part of the Program, that part may be used separately 341 | under those permissions, but the entire Program remains governed by 342 | this License without regard to the additional permissions. 343 | 344 | When you convey a copy of a covered work, you may at your option 345 | remove any additional permissions from that copy, or from any part of 346 | it. (Additional permissions may be written to require their own 347 | removal in certain cases when you modify the work.) You may place 348 | additional permissions on material, added by you to a covered work, 349 | for which you have or can give appropriate copyright permission. 350 | 351 | Notwithstanding any other provision of this License, for material you 352 | add to a covered work, you may (if authorized by the copyright holders of 353 | that material) supplement the terms of this License with terms: 354 | 355 | a) Disclaiming warranty or limiting liability differently from the 356 | terms of sections 15 and 16 of this License; or 357 | 358 | b) Requiring preservation of specified reasonable legal notices or 359 | author attributions in that material or in the Appropriate Legal 360 | Notices displayed by works containing it; or 361 | 362 | c) Prohibiting misrepresentation of the origin of that material, or 363 | requiring that modified versions of such material be marked in 364 | reasonable ways as different from the original version; or 365 | 366 | d) Limiting the use for publicity purposes of names of licensors or 367 | authors of the material; or 368 | 369 | e) Declining to grant rights under trademark law for use of some 370 | trade names, trademarks, or service marks; or 371 | 372 | f) Requiring indemnification of licensors and authors of that 373 | material by anyone who conveys the material (or modified versions of 374 | it) with contractual assumptions of liability to the recipient, for 375 | any liability that these contractual assumptions directly impose on 376 | those licensors and authors. 377 | 378 | All other non-permissive additional terms are considered "further 379 | restrictions" within the meaning of section 10. If the Program as you 380 | received it, or any part of it, contains a notice stating that it is 381 | governed by this License along with a term that is a further 382 | restriction, you may remove that term. If a license document contains 383 | a further restriction but permits relicensing or conveying under this 384 | License, you may add to a covered work material governed by the terms 385 | of that license document, provided that the further restriction does 386 | not survive such relicensing or conveying. 387 | 388 | If you add terms to a covered work in accord with this section, you 389 | must place, in the relevant source files, a statement of the 390 | additional terms that apply to those files, or a notice indicating 391 | where to find the applicable terms. 392 | 393 | Additional terms, permissive or non-permissive, may be stated in the 394 | form of a separately written license, or stated as exceptions; 395 | the above requirements apply either way. 396 | 397 | 8. Termination. 398 | 399 | You may not propagate or modify a covered work except as expressly 400 | provided under this License. Any attempt otherwise to propagate or 401 | modify it is void, and will automatically terminate your rights under 402 | this License (including any patent licenses granted under the third 403 | paragraph of section 11). 404 | 405 | However, if you cease all violation of this License, then your 406 | license from a particular copyright holder is reinstated (a) 407 | provisionally, unless and until the copyright holder explicitly and 408 | finally terminates your license, and (b) permanently, if the copyright 409 | holder fails to notify you of the violation by some reasonable means 410 | prior to 60 days after the cessation. 411 | 412 | Moreover, your license from a particular copyright holder is 413 | reinstated permanently if the copyright holder notifies you of the 414 | violation by some reasonable means, this is the first time you have 415 | received notice of violation of this License (for any work) from that 416 | copyright holder, and you cure the violation prior to 30 days after 417 | your receipt of the notice. 418 | 419 | Termination of your rights under this section does not terminate the 420 | licenses of parties who have received copies or rights from you under 421 | this License. If your rights have been terminated and not permanently 422 | reinstated, you do not qualify to receive new licenses for the same 423 | material under section 10. 424 | 425 | 9. Acceptance Not Required for Having Copies. 426 | 427 | You are not required to accept this License in order to receive or 428 | run a copy of the Program. Ancillary propagation of a covered work 429 | occurring solely as a consequence of using peer-to-peer transmission 430 | to receive a copy likewise does not require acceptance. However, 431 | nothing other than this License grants you permission to propagate or 432 | modify any covered work. These actions infringe copyright if you do 433 | not accept this License. Therefore, by modifying or propagating a 434 | covered work, you indicate your acceptance of this License to do so. 435 | 436 | 10. Automatic Licensing of Downstream Recipients. 437 | 438 | Each time you convey a covered work, the recipient automatically 439 | receives a license from the original licensors, to run, modify and 440 | propagate that work, subject to this License. You are not responsible 441 | for enforcing compliance by third parties with this License. 442 | 443 | An "entity transaction" is a transaction transferring control of an 444 | organization, or substantially all assets of one, or subdividing an 445 | organization, or merging organizations. If propagation of a covered 446 | work results from an entity transaction, each party to that 447 | transaction who receives a copy of the work also receives whatever 448 | licenses to the work the party's predecessor in interest had or could 449 | give under the previous paragraph, plus a right to possession of the 450 | Corresponding Source of the work from the predecessor in interest, if 451 | the predecessor has it or can get it with reasonable efforts. 452 | 453 | You may not impose any further restrictions on the exercise of the 454 | rights granted or affirmed under this License. For example, you may 455 | not impose a license fee, royalty, or other charge for exercise of 456 | rights granted under this License, and you may not initiate litigation 457 | (including a cross-claim or counterclaim in a lawsuit) alleging that 458 | any patent claim is infringed by making, using, selling, offering for 459 | sale, or importing the Program or any portion of it. 460 | 461 | 11. Patents. 462 | 463 | A "contributor" is a copyright holder who authorizes use under this 464 | License of the Program or a work on which the Program is based. The 465 | work thus licensed is called the contributor's "contributor version". 466 | 467 | A contributor's "essential patent claims" are all patent claims 468 | owned or controlled by the contributor, whether already acquired or 469 | hereafter acquired, that would be infringed by some manner, permitted 470 | by this License, of making, using, or selling its contributor version, 471 | but do not include claims that would be infringed only as a 472 | consequence of further modification of the contributor version. For 473 | purposes of this definition, "control" includes the right to grant 474 | patent sublicenses in a manner consistent with the requirements of 475 | this License. 476 | 477 | Each contributor grants you a non-exclusive, worldwide, royalty-free 478 | patent license under the contributor's essential patent claims, to 479 | make, use, sell, offer for sale, import and otherwise run, modify and 480 | propagate the contents of its contributor version. 481 | 482 | In the following three paragraphs, a "patent license" is any express 483 | agreement or commitment, however denominated, not to enforce a patent 484 | (such as an express permission to practice a patent or covenant not to 485 | sue for patent infringement). To "grant" such a patent license to a 486 | party means to make such an agreement or commitment not to enforce a 487 | patent against the party. 488 | 489 | If you convey a covered work, knowingly relying on a patent license, 490 | and the Corresponding Source of the work is not available for anyone 491 | to copy, free of charge and under the terms of this License, through a 492 | publicly available network server or other readily accessible means, 493 | then you must either (1) cause the Corresponding Source to be so 494 | available, or (2) arrange to deprive yourself of the benefit of the 495 | patent license for this particular work, or (3) arrange, in a manner 496 | consistent with the requirements of this License, to extend the patent 497 | license to downstream recipients. "Knowingly relying" means you have 498 | actual knowledge that, but for the patent license, your conveying the 499 | covered work in a country, or your recipient's use of the covered work 500 | in a country, would infringe one or more identifiable patents in that 501 | country that you have reason to believe are valid. 502 | 503 | If, pursuant to or in connection with a single transaction or 504 | arrangement, you convey, or propagate by procuring conveyance of, a 505 | covered work, and grant a patent license to some of the parties 506 | receiving the covered work authorizing them to use, propagate, modify 507 | or convey a specific copy of the covered work, then the patent license 508 | you grant is automatically extended to all recipients of the covered 509 | work and works based on it. 510 | 511 | A patent license is "discriminatory" if it does not include within 512 | the scope of its coverage, prohibits the exercise of, or is 513 | conditioned on the non-exercise of one or more of the rights that are 514 | specifically granted under this License. You may not convey a covered 515 | work if you are a party to an arrangement with a third party that is 516 | in the business of distributing software, under which you make payment 517 | to the third party based on the extent of your activity of conveying 518 | the work, and under which the third party grants, to any of the 519 | parties who would receive the covered work from you, a discriminatory 520 | patent license (a) in connection with copies of the covered work 521 | conveyed by you (or copies made from those copies), or (b) primarily 522 | for and in connection with specific products or compilations that 523 | contain the covered work, unless you entered into that arrangement, 524 | or that patent license was granted, prior to 28 March 2007. 525 | 526 | Nothing in this License shall be construed as excluding or limiting 527 | any implied license or other defenses to infringement that may 528 | otherwise be available to you under applicable patent law. 529 | 530 | 12. No Surrender of Others' Freedom. 531 | 532 | If conditions are imposed on you (whether by court order, agreement or 533 | otherwise) that contradict the conditions of this License, they do not 534 | excuse you from the conditions of this License. If you cannot convey a 535 | covered work so as to satisfy simultaneously your obligations under this 536 | License and any other pertinent obligations, then as a consequence you may 537 | not convey it at all. For example, if you agree to terms that obligate you 538 | to collect a royalty for further conveying from those to whom you convey 539 | the Program, the only way you could satisfy both those terms and this 540 | License would be to refrain entirely from conveying the Program. 541 | 542 | 13. Remote Network Interaction; Use with the GNU General Public License. 543 | 544 | Notwithstanding any other provision of this License, if you modify the 545 | Program, your modified version must prominently offer all users 546 | interacting with it remotely through a computer network (if your version 547 | supports such interaction) an opportunity to receive the Corresponding 548 | Source of your version by providing access to the Corresponding Source 549 | from a network server at no charge, through some standard or customary 550 | means of facilitating copying of software. This Corresponding Source 551 | shall include the Corresponding Source for any work covered by version 3 552 | of the GNU General Public License that is incorporated pursuant to the 553 | following paragraph. 554 | 555 | Notwithstanding any other provision of this License, you have 556 | permission to link or combine any covered work with a work licensed 557 | under version 3 of the GNU General Public License into a single 558 | combined work, and to convey the resulting work. The terms of this 559 | License will continue to apply to the part which is the covered work, 560 | but the work with which it is combined will remain governed by version 561 | 3 of the GNU General Public License. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU Affero General Public License from time to time. Such new versions 567 | will be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU Affero General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU Affero General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU Affero General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU Affero General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU Affero General Public License for more details. 646 | 647 | You should have received a copy of the GNU Affero General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If your software can interact with users remotely through a computer 653 | network, you should also make sure that it provides a way for users to 654 | get its source. For example, if your program is a web application, its 655 | interface could display a "Source" link that leads users to an archive 656 | of the code. There are many ways you could offer source, and different 657 | solutions will be better for different programs; see section 13 for the 658 | specific requirements. 659 | 660 | You should also get your employer (if you work as a programmer) or school, 661 | if any, to sign a "copyright disclaimer" for the program, if necessary. 662 | For more information on this, and how to apply and follow the GNU AGPL, see 663 | . 664 | 665 | The MIT License (MIT) 666 | Copyright (c) 2013 The following parties: 667 | 668 | Steve Clay (steve@mrclay.org) 669 | Cash Costello (cash.costello@gmail.com) 670 | Brett Profitt (brett.profitt@gmail.com) 671 | Dave Tosh (davidgtosh@gmail.com) 672 | Ben Werdmuller (ben@benwerd.com) 673 | Evan Winslow (evan.b.winslow@gmail.com) 674 | 675 | The MITRE Corportation (jricher@mitre.org) 676 | Curverider Ltd (info@elgg.com) 677 | 678 | Permission is hereby granted, free of charge, to any person obtaining a 679 | copy of this software and associated documentation files (the 680 | "Software"), to deal in the Software without restriction, including 681 | without limitation the rights to use, copy, modify, merge, publish, 682 | distribute, sublicense, and/or sell copies of the Software, and to permit 683 | persons to whom the Software is furnished to do so, subject to the 684 | following conditions: 685 | 686 | The above copyright notice and this permission notice shall be included 687 | in all copies or substantial portions of the Software. 688 | 689 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 690 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 691 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 692 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 693 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 694 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 695 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 696 | 697 | ------------------------------------------------------------------------ 698 | --------------------------------------------------------------------------------