diff --git a/client/js/app.js b/client/js/app.js index 67601a6f..f91f64fe 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -17,6 +17,7 @@ import store from './store' // ==================================== import localization from './modules/localization' +import telemetry from './modules/telemetry' // ==================================== // Load Helpers diff --git a/client/js/constants/index.js b/client/js/constants/index.js index 56e9acc7..2914f055 100644 --- a/client/js/constants/index.js +++ b/client/js/constants/index.js @@ -1,5 +1,7 @@ import GRAPHQL from './graphql' +import TELEMETRY from './telemetry' export default { - GRAPHQL + GRAPHQL, + TELEMETRY } diff --git a/client/js/constants/telemetry.js b/client/js/constants/telemetry.js new file mode 100644 index 00000000..35b93c1d --- /dev/null +++ b/client/js/constants/telemetry.js @@ -0,0 +1,4 @@ +export default { + GA_ID: 'UA-9094100-7', + GA_REMOTE: 'http://www.google-analytics.com/collect' +} diff --git a/client/js/modules/telemetry.js b/client/js/modules/telemetry.js new file mode 100644 index 00000000..5ed667ac --- /dev/null +++ b/client/js/modules/telemetry.js @@ -0,0 +1,27 @@ +import uuid from 'uuid/v4' + +/* global CONSTANTS, wiki */ + +export default { + cid: '', + init() { + this.cid = uuid() + }, + sendEvent() { + wiki.$http.post(CONSTANTS.TELEMETRY.GA_REMOTE, { + v: 1, // API version + tid: CONSTANTS.TELEMETRY.GA_ID, // Tracking ID + aip: 1, // Anonymize IP + ds: 'server', // Data source + t: 'event', // Hit Type + ec: 'setup', // Event Category + ea: 'start', // Event Action + el: 'success', // Event Label + ev: 1 // Event Value + }).then(resp => { + + }, err => { + console.error(err) + }) + } +} diff --git a/config.sample.yml b/config.sample.yml index aa1e7c0a..2cafcb3a 100644 --- a/config.sample.yml +++ b/config.sample.yml @@ -5,23 +5,9 @@ # https://docs.requarks.io/wiki/install # --------------------------------------------------------------------- -# Title of this site +# Port the main server should listen to # --------------------------------------------------------------------- -title: Wiki - -# --------------------------------------------------------------------- -# Full public path to the site, without the trailing slash -# --------------------------------------------------------------------- -# INCLUDE CLIENT PORT IF NOT 80/443! - -host: http://localhost - -# --------------------------------------------------------------------- -# Port the main server should listen to (80 by default) -# --------------------------------------------------------------------- -# To use process.env.PORT, comment the line below: - port: 80 # --------------------------------------------------------------------- @@ -33,140 +19,41 @@ paths: data: ./data # --------------------------------------------------------------------- -# Upload Limits +# Database # --------------------------------------------------------------------- -# In megabytes (MB) -uploads: - maxImageFileSize: 3 - maxOtherFileSize: 100 +db: + host: localhost + port: 5432 + user: wikijs + pass: wikijsrocks + db: wiki # --------------------------------------------------------------------- -# Site Language +# Redis # --------------------------------------------------------------------- -# Possible values: en, de, es, fa, fr, ja, ko, nl, pt, ru, sr, tr or zh -lang: en +redis: + host: localhost + port: 6379 + db: 0 + password: null # Enable for right to left languages (e.g. arabic): langRtl: false # --------------------------------------------------------------------- -# Site Authentication -# --------------------------------------------------------------------- - -public: false - -auth: - defaultReadAccess: false - local: - enabled: true - google: - enabled: true - clientId: GOOGLE_CLIENT_ID - clientSecret: GOOGLE_CLIENT_SECRET - microsoft: - enabled: true - clientId: MS_APP_ID - clientSecret: MS_APP_SECRET - facebook: - enabled: false - clientId: FACEBOOK_APP_ID - clientSecret: FACEBOOK_APP_SECRET - github: - enabled: false - clientId: GITHUB_CLIENT_ID - clientSecret: GITHUB_CLIENT_SECRET - slack: - enabled: false - clientId: 'SLACK_CLIENT_ID' - clientSecret: 'SLACK_CLIENT_SECRET' - ldap: - enabled: false - url: ldap://serverhost:389 - bindDn: cn='root' - bindCredentials: BIND_PASSWORD - searchBase: o=users,o=example.com - searchFilter: (uid={{username}}) - tlsEnabled: false - tlsCertPath: C:\example\root_ca_cert.crt - azure: - enabled: false - clientId: APP_ID - clientSecret: APP_SECRET_KEY - resource: '00000002-0000-0000-c000-000000000000' - tenant: 'YOUR_TENANT.onmicrosoft.com' - -# --------------------------------------------------------------------- -# Secret key to use when encrypting sessions -# --------------------------------------------------------------------- -# Use a long and unique random string (256-bit keys are perfect!) - -sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz - -# --------------------------------------------------------------------- -# Database Connection String -# --------------------------------------------------------------------- -# You can also use an ENV variable by using $ENV_VAR_NAME as the value - -db: mongodb://localhost:27017/wiki - -# --------------------------------------------------------------------- -# Git Connection Info -# --------------------------------------------------------------------- - -git: - url: https://github.com/Organization/Repo - branch: master - auth: - - # Type: basic or ssh - type: ssh - - # Only for Basic authentication: - username: marty - password: MartyMcFly88 - - # Only for SSH authentication: - privateKey: /etc/wiki/keys/git.pem - - sslVerify: true - - # Default email to use as commit author - serverEmail: marty@example.com - - # Whether to use user email as author in commits - showUserEmail: true - -# --------------------------------------------------------------------- -# Features -# --------------------------------------------------------------------- -# You can enable / disable specific features below - -features: - linebreaks: true - mathjax: true - -# --------------------------------------------------------------------- -# External Logging +# Background Workers # --------------------------------------------------------------------- +# Leave 0 for auto based on CPU cores -externalLogging: - bugsnag: false - loggly: false - papertrail: false - rollbar: false - sentry: false +workers: 0 # --------------------------------------------------------------------- -# Color Theme +# High Availability # --------------------------------------------------------------------- +# Read the docs BEFORE changing these settings! -theme: - primary: indigo - alt: blue-grey - viewSource: all # all | write | false - footer: blue-grey - code: - dark: true - colorize: true +ha: + nodeuid: primary + readonly: false diff --git a/package.json b/package.json index 692165db..92d5ec0e 100644 --- a/package.json +++ b/package.json @@ -121,6 +121,7 @@ "stream-to-promise": "2.2.0", "tar": "4.0.1", "through2": "2.0.3", + "uuid": "3.1.0", "validator": "9.0.0", "validator-as-promised": "1.0.2", "winston": "2.4.0", diff --git a/server/views/configure/index.pug b/server/views/configure/index.pug index aa268c77..5601895f 100644 --- a/server/views/configure/index.pug +++ b/server/views/configure/index.pug @@ -29,7 +29,7 @@ block body section p.control.is-fullwidth input#ipt-telemetry(type='checkbox', v-model='conf.telemetry', name='ipt-telemetry') - label.label(for='ipt-telemetry') Enable telemetry + label.label(for='ipt-telemetry') Allow Telemetry span.desc Help Wiki.js developers improve this app with anonymized #[a(href='https://wiki.requarks.io/docs/telemetry') telemetry]. p.control.is-fullwidth input#ipt-upgrade(type='checkbox', v-model='conf.upgrade', name='ipt-upgrade') diff --git a/yarn.lock b/yarn.lock index 343424e2..ab85deaa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7633,14 +7633,14 @@ utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" +uuid@3.1.0, uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + uuid@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" - v8flags@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"