├── VERSION ├── math ├── tmp │ └── .touchfile ├── system.properties ├── .nrepl.edn ├── CONTRIBUTING.md ├── Dockerfile ├── .dockerignore ├── .gitignore ├── bin │ ├── util-server │ └── run ├── src │ ├── polismath │ │ ├── components │ │ │ ├── random.clj │ │ │ └── env.clj │ │ └── util │ │ │ └── pretty_printers.clj │ └── data_readers.clj └── test │ └── utils_test.clj ├── server ├── .nvmrc ├── types │ ├── akismet.d.ts │ ├── boolean.d.ts │ ├── badwords.d.ts │ └── google-cloud__translate.d.ts ├── postgres │ └── migrations │ │ ├── 000004_drop_waitinglist_table.sql │ │ ├── 000003_add_origin_permanent_cookie_columns.sql │ │ ├── 000001_update_pwreset_table.sql │ │ ├── 000002_add_xid_constraint.sql │ │ ├── archived │ │ ├── db_000002.sql │ │ ├── db_000006.sql │ │ ├── db_000008.sql │ │ ├── db_000004.sql │ │ └── db_000010.sql │ │ ├── 000006_update_votes_rule.sql │ │ └── 000005_drop_slack_stripe_canvas.sql ├── .dockerignore ├── .gitignore ├── prettier.config.js ├── test │ ├── settings │ │ ├── test.env │ │ └── env-setup.ts │ └── api.test.ts ├── bin │ ├── stringifyGoogleCreds.js │ ├── copyGoogleCredsToHeroku │ └── herokuConfigExport ├── .vscode │ └── settings.json ├── jest.config.ts ├── src │ └── utils │ │ ├── constants.ts │ │ └── fail.ts ├── Dockerfile-db ├── example.env ├── .eslintrc.js └── Dockerfile ├── client-report ├── .npmignore ├── .nvmrc ├── .jshintrc ├── public │ ├── favicon.ico │ └── index.html ├── .babelrc ├── .gitignore ├── .dockerignore ├── .editorconfig ├── .eslintrc.yml ├── src │ ├── STATELESS_TEMPLATE.js │ ├── util │ │ ├── style.js │ │ └── dataUtils.js │ ├── components │ │ ├── framework │ │ │ ├── Footer.js │ │ │ └── legend.js │ │ └── participantsGraph │ │ │ └── hull.js │ ├── index.js │ ├── index.css │ └── store │ │ └── index.js ├── Dockerfile └── webpack.common.js ├── file-server ├── .nvmrc ├── .gitignore ├── .editorconfig ├── .dockerignore ├── nginx.Dockerfile ├── package.json ├── nginx │ ├── nginx-ssl.site.default.conf │ └── certs │ │ └── snakeoil.cert.pem └── app.js ├── client-participation ├── js │ ├── templates │ │ ├── topComments.handlebars │ │ ├── topCommentsItem.handlebars │ │ ├── footer.handlebars │ │ ├── results-view.handlebars │ │ ├── header.handlebars │ │ ├── link-AddPolis-partial.handlebars │ │ ├── root.handlebars │ │ ├── link-TOS-partial.handlebars │ │ ├── link-privacy-partial.handlebars │ │ ├── icon_fa_angle_left.handlebars │ │ ├── icon_fa_angle_right.handlebars │ │ ├── profilePicView.handlebars │ │ ├── countBadge.handlebars │ │ ├── icon_fa_times.handlebars │ │ ├── icon_fa_facebook_square_16.handlebars │ │ ├── icon_fa_facebook_square_25.handlebars │ │ ├── commentView.handlebars │ │ ├── cookiesDisabled.handlebars │ │ ├── icon_fa_ban.handlebars │ │ ├── icon_fa_twitter_16.handlebars │ │ ├── icon_fa_twitter_25.handlebars │ │ ├── voteMore.handlebars │ │ ├── icon_fa_check_circle.handlebars │ │ ├── icon_fa_asterisk.handlebars │ │ ├── conversation-stats-header.handlebars │ │ ├── groupSelectionView.handlebars │ │ └── icon_fa_lightbulb_o.handlebars │ ├── model.js │ ├── collection.js │ ├── layout-view.js │ ├── collection-view.js │ ├── util │ │ ├── url.js │ │ ├── ab.js │ │ ├── randomWithSeed.js │ │ ├── assemble.js │ │ ├── shuffleWithSeed.js │ │ ├── constants.js │ │ └── popoverEach.js │ ├── models │ │ ├── twitterUser.js │ │ ├── user.js │ │ ├── comment.js │ │ ├── participant.js │ │ ├── rule.js │ │ └── vote.js │ ├── collections │ │ ├── votes.js │ │ └── comments.js │ ├── views │ │ ├── commentView.js │ │ ├── writingTips.js │ │ ├── root.js │ │ ├── voteMoreView.js │ │ ├── conversation-stats-header.js │ │ ├── settings.js │ │ └── conversationInfoSlideView.js │ ├── net │ │ ├── bbFetch.js │ │ ├── bbDestroy.js │ │ └── bbSave.js │ ├── lib │ │ ├── PolisView.js │ │ └── PolisModelView.js │ └── stores │ │ └── currentUser.js ├── .babelrc ├── public │ ├── favicon.ico │ └── twitterAuthReturn.html ├── css │ ├── owlcarousel │ │ └── owl.custom.scss │ ├── polis │ │ ├── layout │ │ │ └── _grid.scss │ │ ├── modules │ │ │ ├── _intercom.scss │ │ │ ├── _toggle.scss │ │ │ ├── _lists.scss │ │ │ ├── _legend.scss │ │ │ ├── _accordion.scss │ │ │ ├── _notifications.scss │ │ │ ├── _share.scss │ │ │ ├── _navigation.scss │ │ │ └── _starterComments.scss │ │ └── states │ │ │ └── _states.scss │ └── pca_vis.scss ├── .gitignore ├── .dockerignore ├── .jshintrc ├── vis2 │ └── components │ │ └── header.js ├── Dockerfile └── api │ └── twitterAuthReturn.html ├── .gitconfig ├── CONTRIBUTING.md ├── e2e ├── .prettierrc ├── .dockerignore ├── .gitignore ├── cypress │ ├── e2e │ │ ├── client-admin │ │ │ ├── public-pages.cy.js │ │ │ └── home.cy.js │ │ └── third-party │ │ │ └── comment-translation.cy.js │ ├── support │ │ ├── e2e.js │ │ └── helpers.js │ └── fixtures │ │ └── users.json ├── .eslintrc.js ├── embed │ ├── integrated-template.html │ └── template.html ├── cypress.config.js ├── docker-compose.yml └── package.json ├── docs ├── docker-architecture.png ├── ssl.md └── upgrading.md ├── package.json ├── client-admin ├── public │ ├── favicon.ico │ ├── 404.html │ └── index.ejs ├── .vscode │ └── settings.json ├── .editorconfig ├── .babelrc ├── .gitignore ├── qa.md ├── .dockerignore ├── .eslintrc.yml ├── src │ ├── components │ │ ├── framework │ │ │ └── logomark.js │ │ ├── landers │ │ │ ├── knowledgeBase.js │ │ │ ├── lander-layout.js │ │ │ ├── tos.js │ │ │ ├── privacy.js │ │ │ ├── lander-footer.js │ │ │ ├── password-reset-init-done.js │ │ │ ├── lander-header.js │ │ │ └── signout.js │ │ ├── conversation-admin │ │ │ ├── no-permission.js │ │ │ ├── report │ │ │ │ └── reports.js │ │ │ └── stats │ │ │ │ └── conversation-stats-number-card.js │ │ ├── conversations-and-account │ │ │ └── conversation.js │ │ └── interior-header.js │ ├── util │ │ ├── url.js │ │ └── component-helpers.js │ ├── reducers │ │ ├── conversation_config.js │ │ ├── stats.js │ │ ├── mod_comments_accepted.js │ │ ├── mod_comments_rejected.js │ │ ├── mod_ptpt_hidden.js │ │ ├── mod_ptpt_default.js │ │ ├── mod_ptpt_featured.js │ │ ├── mod_comments_unmoderated.js │ │ ├── REDUCER_TEMPLATE.js │ │ ├── signout.js │ │ ├── participants.js │ │ ├── math.js │ │ ├── comments.js │ │ └── conversations.js │ ├── strings │ │ ├── strings.js │ │ └── footer.js │ ├── store │ │ └── index.js │ └── index.js └── Dockerfile ├── .gitignore ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── documentation.md │ ├── feature_request.md │ ├── bug_report.md │ └── security-issue.md ├── workflows │ ├── test-clojure.yml │ ├── lint.yml │ └── .github │ │ └── workflows │ │ └── release-dockerhub-images.yml └── FUNDING.yml ├── heroku.yml ├── bin ├── activate-xid-whitelist.clj ├── purge-pii.clj └── add-xid-whitelist.clj ├── test.env ├── docker-compose.test.yml ├── .bundlewatch.config.js └── .vscode ├── launch.json ├── polis.code-workspace └── tasks.json /VERSION: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /math/tmp/.touchfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /client-report/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client-report/.nvmrc: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /file-server/.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /math/system.properties: -------------------------------------------------------------------------------- 1 | java.runtime.version=1.8 2 | -------------------------------------------------------------------------------- /client-report/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esnext": true 3 | } 4 | -------------------------------------------------------------------------------- /math/.nrepl.edn: -------------------------------------------------------------------------------- 1 | {:port 18975 2 | :bind "0.0.0.0"} 3 | -------------------------------------------------------------------------------- /server/types/akismet.d.ts: -------------------------------------------------------------------------------- 1 | declare module "akismet"; 2 | -------------------------------------------------------------------------------- /server/types/boolean.d.ts: -------------------------------------------------------------------------------- 1 | declare module "boolean"; 2 | -------------------------------------------------------------------------------- /server/types/badwords.d.ts: -------------------------------------------------------------------------------- 1 | declare module "badwords/object"; 2 | -------------------------------------------------------------------------------- /client-participation/js/templates/topComments.handlebars: -------------------------------------------------------------------------------- 1 |
{txt}
-------------------------------------------------------------------------------- /file-server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | fs_config.json 4 | -------------------------------------------------------------------------------- /server/types/google-cloud__translate.d.ts: -------------------------------------------------------------------------------- 1 | declare module "@google-cloud/translate"; 2 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | [log] 2 | # Display full log history even with file moves. 3 | follow = true 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Expect to see a Contributing Agreement here soon 4 | 5 | -------------------------------------------------------------------------------- /client-participation/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-react" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /server/postgres/migrations/000004_drop_waitinglist_table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS waitinglist; 2 | -------------------------------------------------------------------------------- /e2e/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "semi": false, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /server/.dockerignore: -------------------------------------------------------------------------------- 1 | .env 2 | .git 3 | .google_creds_temp 4 | logs/ 5 | node_modules/ 6 | npm-debug.log* 7 | -------------------------------------------------------------------------------- /server/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .google_creds_temp 3 | dist 4 | logs/ 5 | node_modules/ 6 | npm-debug.log* 7 | -------------------------------------------------------------------------------- /docs/docker-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CivicTechTO/polis/HEAD/docs/docker-architecture.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "note": "Just a workaround, as bundlewatch needs a package.json file to read." 3 | } 4 | -------------------------------------------------------------------------------- /client-admin/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CivicTechTO/polis/HEAD/client-admin/public/favicon.ico -------------------------------------------------------------------------------- /client-report/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CivicTechTO/polis/HEAD/client-report/public/favicon.ico -------------------------------------------------------------------------------- /e2e/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | cypress/screenshots 3 | cypress/videos 4 | cypress/logs 5 | .git 6 | .vscode 7 | -------------------------------------------------------------------------------- /client-participation/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CivicTechTO/polis/HEAD/client-participation/public/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .clj-kondo/ 3 | .env 4 | .envrc 5 | .lsp/ 6 | .vscode/settings.json 7 | build/ 8 | prod.env 9 | xids.csv 10 | -------------------------------------------------------------------------------- /e2e/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | cypress/downloads 3 | cypress/logs 4 | cypress/screenshots 5 | cypress/videos 6 | embed/*index.html 7 | node_modules 8 | -------------------------------------------------------------------------------- /server/prettier.config.js: -------------------------------------------------------------------------------- 1 | // prettier.config.js or .prettierrc.js 2 | // docs: https://prettier.io/docs/en/options.html 3 | module.exports = {} 4 | -------------------------------------------------------------------------------- /client-admin/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "search.exclude": { 3 | "**/*.code-search": false, 4 | "**/node_modules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /client-report/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/env", "@babel/react"], 3 | "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]] 4 | } 5 | -------------------------------------------------------------------------------- /client-participation/css/owlcarousel/owl.custom.scss: -------------------------------------------------------------------------------- 1 | 2 | .owl-carousel .owl-wrapper-outer{ 3 | overflow: visible; 4 | position: relative; 5 | width: 100%; 6 | } 7 | -------------------------------------------------------------------------------- /server/test/settings/test.env: -------------------------------------------------------------------------------- 1 | # Unique values for test environment 2 | DEV_MODE=true 3 | API_SERVER_PORT=5050 # Must be different than server port to avoid collision. 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # This helps prevent conflicts (well, at last when GitHub implements it...) 2 | # See: https://github.com/isaacs/github/issues/487 3 | CHANGELOG.md merge=union 4 | -------------------------------------------------------------------------------- /math/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # Submitting Pull Requests 3 | 4 | Before we can accept pull requests, you'll need you to sign the Polis Contributor Agreement. https://pol.is/contrib 5 | -------------------------------------------------------------------------------- /server/bin/stringifyGoogleCreds.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const o = JSON.parse(fs.readFileSync(process.argv[2])) 3 | const s = JSON.stringify(o).replace('\n',''); 4 | console.log(s); 5 | -------------------------------------------------------------------------------- /server/postgres/migrations/000003_add_origin_permanent_cookie_columns.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE participants_extended 2 | ADD COLUMN permanent_cookie VARCHAR(32), 3 | ADD COLUMN origin VARCHAR(9999); 4 | -------------------------------------------------------------------------------- /server/test/settings/env-setup.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | import path from 'path'; 3 | 4 | dotenv.config({ path: path.resolve(process.cwd(), 'test', 'settings', 'test.env') }); 5 | -------------------------------------------------------------------------------- /server/postgres/migrations/000001_update_pwreset_table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE password_reset_tokens RENAME COLUMN pwresettoken TO token; 2 | ALTER TABLE password_reset_tokens RENAME TO pwreset_tokens; 3 | -------------------------------------------------------------------------------- /client-report/.gitignore: -------------------------------------------------------------------------------- 1 | ### OSX ### 2 | .DS_Store 3 | 4 | # App specific 5 | .env_dev 6 | build 7 | devel 8 | dist 9 | node_modules 10 | npm-debug.log 11 | .polis_s3_creds_client.json 12 | -------------------------------------------------------------------------------- /server/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "jest.jestCommandLine": "npx jest --forceExit test", 3 | "jest.autoRun": { 4 | "watch": false, 5 | "onSave": "test-src-file" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /math/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/clojure:tools-deps-bullseye 2 | 3 | WORKDIR /app 4 | COPY . . 5 | 6 | # Install clojure and fetch dependencies 7 | RUN clojure -A:dev -P 8 | 9 | CMD ["./bin/run"] 10 | -------------------------------------------------------------------------------- /client-participation/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | *.log 4 | js/tmpl/ 5 | build 6 | dist 7 | devel 8 | .polis_env 9 | .polis_s3_creds_client.json 10 | .sass-cache/* 11 | .bashrc 12 | .env_always 13 | scratch 14 | -------------------------------------------------------------------------------- /client-report/.dockerignore: -------------------------------------------------------------------------------- 1 | ### OSX ### 2 | .DS_Store 3 | 4 | # App specific 5 | .env_dev 6 | build 7 | devel 8 | dist 9 | node_modules 10 | npm-debug.log 11 | .polis_s3_creds_client.json 12 | 13 | # VCS 14 | .git 15 | -------------------------------------------------------------------------------- /client-admin/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Polis - Page not found - 404 5 | 7 | 8 | 9 | 10 |

Page not found - 404

11 | 12 | 13 | -------------------------------------------------------------------------------- /file-server/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /file-server/.dockerignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | 4 | client-admin/build 5 | client-admin/node_modules/ 6 | 7 | client-participation/dist 8 | client-participation/node_modules 9 | 10 | client-report/build 11 | client-report/node_modules 12 | -------------------------------------------------------------------------------- /server/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | const config: Config = { 4 | preset: 'ts-jest', 5 | setupFiles: ['/test/settings/env-setup.ts'], 6 | testEnvironment: 'node', 7 | }; 8 | 9 | export default config; 10 | -------------------------------------------------------------------------------- /client-participation/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | *.log 4 | js/tmpl/ 5 | build 6 | dist 7 | devel 8 | .polis_env 9 | .polis_s3_creds_client.json 10 | .sass-cache/* 11 | .bashrc 12 | .env_always 13 | polisStatic/ 14 | scratch 15 | 16 | # VCS 17 | .git 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation 3 | about: Documentation suggestions 4 | labels: 'docs' 5 | --- 6 | 7 | **What would you like documented?** 8 | 9 | **Where should it live?** 10 | 11 | **Any additional context which might be relevant?** 12 | 13 | -------------------------------------------------------------------------------- /server/src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | const DEFAULTS = { 2 | auth_needed_to_vote: false, 3 | auth_needed_to_write: true, 4 | auth_opt_allow_3rdparty: true, 5 | auth_opt_fb: true, 6 | auth_opt_tw: true, 7 | }; 8 | 9 | export { DEFAULTS }; 10 | 11 | export default { 12 | DEFAULTS, 13 | }; 14 | -------------------------------------------------------------------------------- /client-admin/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | max_line_length = 100 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /client-report/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | max_line_length = 100 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /client-admin/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env", 4 | "@babel/preset-react" 5 | ], 6 | "plugins": [ 7 | ["@babel/plugin-proposal-decorators", { "legacy": true }], 8 | ["@babel/plugin-proposal-class-properties"], 9 | "lodash", 10 | "@babel/plugin-transform-runtime" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /server/src/utils/fail.ts: -------------------------------------------------------------------------------- 1 | import logger from "./logger"; 2 | 3 | export default function fail( 4 | res: any, 5 | httpCode: any, 6 | clientVisibleErrorString: any, 7 | err?: any 8 | ) { 9 | logger.error(clientVisibleErrorString, err); 10 | res.writeHead(httpCode || 500); 11 | res.end(clientVisibleErrorString); 12 | } 13 | -------------------------------------------------------------------------------- /server/Dockerfile-db: -------------------------------------------------------------------------------- 1 | FROM docker.io/postgres:13.4-alpine 2 | 3 | # Used when no existing database on postgres volume, including first initialization. 4 | # See: docs/deployment.md#database-migrations 5 | # See: https://github.com/docker-library/docs/blob/master/postgres/README.md#initialization-scripts 6 | COPY ./postgres/migrations/*.sql /docker-entrypoint-initdb.d/ 7 | -------------------------------------------------------------------------------- /file-server/nginx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/nginx:1.21.5-alpine 2 | 3 | COPY nginx/nginx-ssl.site.default.conf /etc/nginx/conf.d/default.conf 4 | 5 | # We only use these in testing. 6 | COPY nginx/certs/snakeoil.cert.pem /etc/nginx/certs/snakeoil.cert.pem 7 | COPY nginx/certs/snakeoil.key.pem /etc/nginx/certs/snakeoil.key.pem 8 | 9 | EXPOSE 80 10 | EXPOSE 443 11 | -------------------------------------------------------------------------------- /e2e/cypress/e2e/client-admin/public-pages.cy.js: -------------------------------------------------------------------------------- 1 | describe('Public pages', function () { 2 | it('renders Privacy Policy', function () { 3 | cy.visit('/privacy') 4 | cy.get('h1').should('contain', 'Privacy Policy') 5 | }) 6 | 7 | it('renders Terms of Use', function () { 8 | cy.visit('/tos') 9 | cy.get('h1').should('contain', 'Terms of') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /file-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "polisfileserver", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "serve": "node --max_old_space_size=400 --gc_interval=100 app.js", 8 | "start": "node app.js" 9 | }, 10 | "dependencies": { 11 | "finalhandler": "~1.1.2", 12 | "serve-static": "~1.14.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | 2 | build: 3 | docker: 4 | # web server container 5 | web: server/Dockerfile 6 | # math worker container 7 | worker: math/Dockerfile 8 | # build and release static assets (js, index.html, etc) 9 | #release: Dockerfile 10 | 11 | #release: 12 | #image: release 13 | #command: 14 | #- ./bin/deploy-static-assets.clj --bucket $STATIC_ASSET_DEPLOY_BUCKET 15 | 16 | 17 | -------------------------------------------------------------------------------- /math/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | /lib 3 | /classes 4 | /checkouts 5 | pom.xml 6 | pom.xml.asc 7 | *.jar 8 | *.class 9 | .lein-deps-sum 10 | .lein-failures 11 | .lein-plugins 12 | .lein-repl-history 13 | *.swo 14 | db/ 15 | .lein-env 16 | .nrepl-port 17 | scratch 18 | src/polismath/play.clj 19 | old 20 | .gorilla-port 21 | .lein-git-deps/hiphip 22 | wiki 23 | .lein-git-deps/debug-repl 24 | data 25 | .cpcache 26 | .git 27 | -------------------------------------------------------------------------------- /math/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /lib 3 | /classes 4 | /checkouts 5 | pom.xml 6 | pom.xml.asc 7 | *.jar 8 | *.class 9 | .lein-deps-sum 10 | .lein-failures 11 | .lein-plugins 12 | .lein-repl-history 13 | *.swo 14 | db/ 15 | .lein-env 16 | .nrepl-port 17 | scratch 18 | src/polismath/play.clj 19 | old 20 | .gorilla-port 21 | .lein-git-deps/hiphip 22 | wiki 23 | .lein-git-deps/debug-repl 24 | data 25 | .cpcache 26 | errorconv* 27 | -------------------------------------------------------------------------------- /e2e/cypress/e2e/client-admin/home.cy.js: -------------------------------------------------------------------------------- 1 | describe('Home Page', function () { 2 | beforeEach(function () { 3 | return cy.visit('/') 4 | }) 5 | 6 | it('bare URL redirects to /home', function () { 7 | cy.location('pathname').should('eq', '/home') 8 | }) 9 | 10 | it('has Sign up and Sign in links', function () { 11 | cy.contains('a[href="/createuser"]', 'Sign up').should('be.visible') 12 | cy.contains('a[href="/signin"]', 'Sign in').should('be.visible') 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /client-participation/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "es3": true, 3 | "eqeqeq": true, 4 | "boss": true, 5 | "strict": false, 6 | "unused": false, 7 | "undef": false, 8 | "quotmark": true, 9 | "globals": { 10 | "$": true, 11 | "jQuery": true, 12 | "console": true, 13 | "require": true, 14 | "define": true, 15 | "requirejs": true, 16 | "describe": true, 17 | "expect": true, 18 | "module": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /e2e/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | 'cypress/globals': true, 4 | es2021: true, 5 | node: true, 6 | }, 7 | extends: [ 8 | 'eslint:recommended', 9 | 'plugin:cypress/recommended', 10 | 'plugin:mocha/recommended', 11 | 'prettier', 12 | ], 13 | ignorePatterns: ['eg-cypress'], 14 | overrides: [], 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | sourceType: 'module', 18 | }, 19 | plugins: ['cypress', 'mocha'], 20 | rules: {}, 21 | } 22 | -------------------------------------------------------------------------------- /e2e/embed/integrated-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Integrated Polis Test 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /server/postgres/migrations/000002_add_xid_constraint.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE xids 2 | DROP CONSTRAINT IF EXISTS xids_owner_uid_key; 3 | 4 | DO $$ 5 | BEGIN 6 | IF NOT EXISTS ( SELECT constraint_schema 7 | , constraint_name 8 | FROM information_schema.constraint_column_usage 9 | WHERE constraint_name = 'xids_owner_xid_key' 10 | ) 11 | THEN 12 | ALTER TABLE xids ADD CONSTRAINT xids_owner_xid_key UNIQUE (owner, xid); 13 | END IF; 14 | END$$; 15 | -------------------------------------------------------------------------------- /client-admin/.gitignore: -------------------------------------------------------------------------------- 1 | ### SublimeText ### 2 | *.sublime-workspace 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear on external disk 14 | .Spotlight-V100 15 | .Trashes 16 | 17 | ### Windows ### 18 | # Windows image file caches 19 | Thumbs.db 20 | ehthumbs.db 21 | 22 | # Folder config file 23 | Desktop.ini 24 | 25 | # Recycle Bin used on file shares 26 | $RECYCLE.BIN/ 27 | 28 | # App specific 29 | build 30 | node_modules 31 | npm-debug.log 32 | -------------------------------------------------------------------------------- /server/test/api.test.ts: -------------------------------------------------------------------------------- 1 | import request from "supertest"; 2 | import app from "../app"; 3 | 4 | describe("API", () => { 5 | describe("GET /api/v3/testConnection", () => { 6 | it("should return 200 OK", () => { 7 | return request(app).get("/api/v3/testConnection") 8 | .expect(200); 9 | }); 10 | }); 11 | 12 | describe("GET /api/v3/testDatabase", () => { 13 | it("should return 200 OK", () => { 14 | return request(app).get("/api/v3/testDatabase") 15 | .expect(200); 16 | }); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /client-admin/qa.md: -------------------------------------------------------------------------------- 1 | # QA Script for Admin Dash 2 | 3 | ### Static, outide 4 | 5 | - User can see home page at `/home` 6 | - User is redirected to `/home` if not logged in 7 | - User can sign in at `/signin` 8 | - User can reset password at `/pwreset` 9 | - User can `/createuser` and make a new account, login 10 | - User can see `/privacy` policy 11 | - User can see `/tos` 12 | 13 | ### After login 14 | 15 | - User can get `/integrate` embed code for whole site 16 | - User can see social linkage at `/account` 17 | - User can see all of their conversations 18 | -------------------------------------------------------------------------------- /client-admin/.dockerignore: -------------------------------------------------------------------------------- 1 | ### SublimeText ### 2 | *.sublime-workspace 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear on external disk 14 | .Spotlight-V100 15 | .Trashes 16 | 17 | ### Windows ### 18 | # Windows image file caches 19 | Thumbs.db 20 | ehthumbs.db 21 | 22 | # Folder config file 23 | Desktop.ini 24 | 25 | # Recycle Bin used on file shares 26 | $RECYCLE.BIN/ 27 | 28 | # App specific 29 | build 30 | node_modules 31 | npm-debug.log 32 | 33 | # VCS 34 | .git 35 | -------------------------------------------------------------------------------- /client-admin/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | browser: true 3 | es2020: true 4 | jquery: true 5 | globals: 6 | FB: readonly 7 | plugins: 8 | - babel 9 | - react 10 | extends: 11 | - standard 12 | - prettier 13 | - eslint:recommended 14 | - plugin:react/recommended 15 | rules: 16 | # TODO: Migrate to camelcase. 17 | # snake_case API params and properties makes this a tangled process. 18 | camelcase: off 19 | parser: babel-eslint 20 | parserOptions: 21 | ecmaFeatures: 22 | jsx: true 23 | ecmaVersion: 11 24 | sourceType: module 25 | settings: 26 | react: 27 | version: detect 28 | -------------------------------------------------------------------------------- /client-admin/src/components/framework/logomark.js: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import React from 'react' 3 | import { jsx } from 'theme-ui' 4 | 5 | class Logomark extends React.Component { 6 | render() { 7 | return ( 8 | 14 | 18 | 19 | ) 20 | } 21 | } 22 | 23 | export default Logomark 24 | -------------------------------------------------------------------------------- /client-participation/js/templates/topCommentsItem.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 14 | 15 |
7 | 8 | 9 | {{percent}}% 10 | 12 | {{txt}} 13 |
16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /client-participation/css/polis/layout/_grid.scss: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . 2 | 3 | // GRID 4 | -------------------------------------------------------------------------------- /client-participation/js/templates/footer.handlebars: -------------------------------------------------------------------------------- 1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --}} 2 | 3 | -------------------------------------------------------------------------------- /client-participation/js/templates/results-view.handlebars: -------------------------------------------------------------------------------- 1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --}} 2 | 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: Please write a concise description of the problem here 5 | labels: feature-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Problem**: 11 | Please write a more complete description of your problem, if necessary. 12 | 13 | **Suggested solution**: 14 | If you have a particular solution in mind, please share here. 15 | 16 | **Alternative suggestions**: 17 | * If there are other ways this could be solved 18 | * Please enumerate here. 19 | 20 | **Additional context**: 21 | Please add any other context or screenshots about the feature request here. 22 | -------------------------------------------------------------------------------- /client-admin/src/components/landers/knowledgeBase.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import { Box, Link } from 'theme-ui' 4 | import emoji from 'react-easy-emoji' 5 | 6 | const KnowledgeBase = ({ e, url, txt }) => { 7 | return ( 8 | 9 | 10 | {emoji(e)} 11 | {txt} 12 | 13 | 14 | ) 15 | } 16 | 17 | KnowledgeBase.propTypes = { 18 | e: PropTypes.string.isRequired, 19 | url: PropTypes.string.isRequired, 20 | txt: PropTypes.string.isRequired 21 | } 22 | 23 | export default KnowledgeBase 24 | -------------------------------------------------------------------------------- /client-participation/js/templates/header.handlebars: -------------------------------------------------------------------------------- 1 | {{!-- Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --}} 2 | 3 |
4 | 5 |
6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Something doesn't seem to be working correctly 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Expected behavior**: 11 | Please describe the expected behavior here. 12 | 13 | **Actual behavior**: 14 | Please describe the actual behavior here. 15 | 16 | **To Reproduce**: 17 | Please list detailed steps to reproduce here. 18 | 19 | **Screenshots**: 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Device information**: 23 | Please list any device details here. 24 | 25 | **Additional context**: 26 | Add any other context about the problem here which might be helpful. 27 | -------------------------------------------------------------------------------- /client-participation/css/pca_vis.scss: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . 2 | 3 | /* moved to css/polis/modules/_visualization.scss */ 4 | -------------------------------------------------------------------------------- /e2e/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | import './commands' 17 | require('cypress-terminal-report/src/installLogsCollector')() 18 | -------------------------------------------------------------------------------- /client-admin/src/components/landers/lander-layout.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PropTypes from 'prop-types' 3 | import Header from './lander-header' 4 | import Footer from './lander-footer' 5 | import { Box } from 'theme-ui' 6 | 7 | const Layout = ({ children }) => { 8 | const globalWidth = '45em' 9 | return ( 10 | 16 |
17 | {children} 18 |