chore: simplify CRM to official Monica deployment
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
.circleci/
|
||||
.azure/
|
||||
.vscode/
|
||||
.composer/
|
||||
.git/
|
||||
.gitattributes
|
||||
.github/
|
||||
.gitignore
|
||||
**/.gitignore
|
||||
**/.gitkeep
|
||||
bootstrap/cache/*
|
||||
database/*.sqlite
|
||||
.env
|
||||
CODE_OF_CONDUCT.md
|
||||
docker-compose.yml
|
||||
docker-compose.dev.yml
|
||||
Dockerfile
|
||||
Dockerfile.dev
|
||||
.dockerignore
|
||||
docs/
|
||||
fortrabbit.yml
|
||||
Homestead.*
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
persist/
|
||||
.phpunit.result.cache
|
||||
Procfile
|
||||
public/storage
|
||||
resources/vendor/
|
||||
results/
|
||||
.sass-lint.yml
|
||||
scripts/tests
|
||||
scripts/vagrant
|
||||
sonar-project.properties
|
||||
storage/app/public/*
|
||||
storage/debugbar/*
|
||||
storage/framework/cache/*
|
||||
storage/framework/sessions/*
|
||||
storage/framework/views/*
|
||||
storage/logs/*
|
||||
.styleci.yml
|
||||
.travis.yml*
|
||||
vendor/
|
||||
yarn-error.log
|
||||
.sonarlint/
|
||||
cypress.env.json
|
||||
@@ -1,24 +0,0 @@
|
||||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.blade.php]
|
||||
indent_size = 2
|
||||
|
||||
[*.{js,vue,scss}]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
76
.env.dev
76
.env.dev
@@ -1,76 +0,0 @@
|
||||
APP_ENV=local
|
||||
APP_DEBUG=true
|
||||
|
||||
APP_KEY=ChangeMeBy32KeyLengthOrGenerated
|
||||
HASH_SALT=ChangeMeBy20+KeyLength
|
||||
HASH_LENGTH=18
|
||||
|
||||
APP_URL=http://localhost
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=monica
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
DB_PREFIX=
|
||||
|
||||
# Mail credentials used to send emails from the application.
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=fake_mail
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=
|
||||
MAIL_FROM_NAME="Some Name"
|
||||
APP_EMAIL_NEW_USERS_NOTIFICATION=
|
||||
|
||||
# Default locale used in the application.
|
||||
APP_DEFAULT_LOCALE=en
|
||||
|
||||
# Ability to disable signups on your instance.
|
||||
# Can be true or false. Default to false.
|
||||
APP_DISABLE_SIGNUP=false
|
||||
# Enable user email verification.
|
||||
APP_SIGNUP_DOUBLE_OPTIN=false
|
||||
|
||||
# Set trusted proxy IP addresses. Useful for ssl terminating loadbalancers.
|
||||
# To trust all proxies that connect directly to your server, use a "*".
|
||||
# To trust one or more specific proxies that connect directly to your server, use a comma separated list of IP addresses.
|
||||
APP_TRUSTED_PROXIES=
|
||||
|
||||
# Frequency of creation of new log files. Logs are written when an error occurs.
|
||||
# Refer to config/logging.php for the possible values.
|
||||
LOG_CHANNEL=single
|
||||
|
||||
SENTRY_SUPPORT=false
|
||||
SENTRY_LARAVEL_DSN=
|
||||
|
||||
CHECK_VERSION=false
|
||||
|
||||
REQUIRES_SUBSCRIPTION=false
|
||||
|
||||
# Change this only if you know what you are doing
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_CONNECTION=sync
|
||||
BROADCAST_DRIVER=log
|
||||
|
||||
# Default filesystem to store uploaded files.
|
||||
# Possible values: public|s3
|
||||
FILESYSTEM_DISK=public
|
||||
|
||||
# AWS keys for S3 when using this storage method
|
||||
AWS_KEY=
|
||||
AWS_SECRET=
|
||||
AWS_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_SERVER=
|
||||
|
||||
# Allow Two Factor Authentication feature on your instance
|
||||
MFA_ENABLED=true
|
||||
|
||||
# Enable DAV support (beta feature)
|
||||
DAV_ENABLED=true
|
||||
176
.env.example
176
.env.example
@@ -1,176 +0,0 @@
|
||||
#
|
||||
# Welcome, friend ❤. Thanks for trying out Monica. We hope you'll have fun.
|
||||
#
|
||||
|
||||
# Two choices: local|production. Use local if you want to install Monica as a
|
||||
# development version. Use production otherwise.
|
||||
APP_ENV=local
|
||||
|
||||
# true if you want to show debug information on errors. For production, put this
|
||||
# to false.
|
||||
APP_DEBUG=false
|
||||
|
||||
# The encryption key. This is the most important part of the application. Keep
|
||||
# this secure otherwise, everyone will be able to access your application.
|
||||
# Must be 32 characters long exactly.
|
||||
# Use `php artisan key:generate` or `echo -n 'base64:'; openssl rand -base64 32` to generate a random key.
|
||||
APP_KEY=ChangeMeBy32KeyLengthOrGenerated
|
||||
|
||||
# Prevent information leakage by referring to IDs with hashIds instead of
|
||||
# the actual IDs used in the database.
|
||||
HASH_SALT=ChangeMeBy20+KeyLength
|
||||
HASH_LENGTH=18
|
||||
|
||||
# The URL of your application.
|
||||
APP_URL=http://localhost
|
||||
|
||||
# Force using APP_URL as base url of your application.
|
||||
# You should not need this, unless you are using subdirectory config.
|
||||
APP_FORCE_URL=false
|
||||
|
||||
# Database information
|
||||
# To keep this information secure, we urge you to change the default password
|
||||
# Currently only "mysql" compatible servers are working
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
# You can use mysql unix socket if available, it overrides DB_HOST and DB_PORT values.
|
||||
#DB_UNIX_SOCKET=/var/run/mysqld/mysqld.sock
|
||||
DB_DATABASE=monica
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
DB_PREFIX=
|
||||
DB_TEST_HOST=127.0.0.1
|
||||
DB_TEST_PORT=3306
|
||||
DB_TEST_DATABASE=monica_test
|
||||
DB_TEST_USERNAME=homestead
|
||||
DB_TEST_PASSWORD=secret
|
||||
|
||||
# Use utf8mb4 database charset format to support emoji characters
|
||||
# ⚠ be sure your DBMS supports utf8mb4 format
|
||||
DB_USE_UTF8MB4=true
|
||||
|
||||
# Mail credentials used to send emails from the application.
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=
|
||||
MAIL_PASSWORD=
|
||||
MAIL_ENCRYPTION=
|
||||
# Outgoing emails will be sent with these identity
|
||||
MAIL_FROM_ADDRESS=
|
||||
MAIL_FROM_NAME="Monica instance"
|
||||
# New registration notification sent to this email
|
||||
APP_EMAIL_NEW_USERS_NOTIFICATION=
|
||||
|
||||
# Ability to disable signups on your instance.
|
||||
# Can be true or false. Default to false.
|
||||
APP_DISABLE_SIGNUP=true
|
||||
|
||||
# Enable user email verification.
|
||||
APP_SIGNUP_DOUBLE_OPTIN=false
|
||||
|
||||
# Set trusted proxy IP addresses.
|
||||
# To trust all proxies that connect directly to your server, use a "*".
|
||||
# To trust one or more specific proxies that connect directly to your server,
|
||||
# use a comma separated list of IP addresses.
|
||||
APP_TRUSTED_PROXIES=
|
||||
|
||||
# Enable automatic cloudflare trusted proxy discover
|
||||
APP_TRUSTED_CLOUDFLARE=false
|
||||
|
||||
# Frequency of creation of new log files. Logs are written when an error occurs.
|
||||
# Refer to config/logging.php for the possible values.
|
||||
LOG_CHANNEL=daily
|
||||
|
||||
# Error tracking. Specific to hosted version on .com. You probably don't need
|
||||
# those.
|
||||
SENTRY_SUPPORT=false
|
||||
SENTRY_LARAVEL_DSN=
|
||||
|
||||
# Send a daily ping to https://version.monicahq.com to check if a new version
|
||||
# is available. When a new version is detected, you will have a message in the
|
||||
# UI, as well as the release notes for the new changes. Can be true or false.
|
||||
# Default to true.
|
||||
CHECK_VERSION=true
|
||||
|
||||
# Cache, session, and queue parameters
|
||||
# ⚠ Change this only if you know what you are doing
|
||||
#. Cache: database, file, memcached, redis, dynamodb
|
||||
#. Session: file, cookie, database, apc, memcached, redis, array
|
||||
#. Queue: sync, database, beanstalkd, sqs, redis
|
||||
# If Queue is not set to 'sync', you'll have to set a queue worker
|
||||
# See https://laravel.com/docs/5.7/queues#running-the-queue-worker
|
||||
CACHE_DRIVER=database
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
QUEUE_CONNECTION=sync
|
||||
|
||||
# If you use redis, set the redis host or ip, like:
|
||||
#REDIS_HOST=redis
|
||||
|
||||
# Maximum allowed size for uploaded files, in kilobytes.
|
||||
# Make sure this is an integer, without commas or spaces.
|
||||
DEFAULT_MAX_UPLOAD_SIZE=10240
|
||||
|
||||
# Maximum allowed storage size per account, in megabytes.
|
||||
# Make sure this is an integer, without commas or spaces.
|
||||
DEFAULT_MAX_STORAGE_SIZE=512
|
||||
|
||||
# Default filesystem to store uploaded files.
|
||||
# Possible values: public|s3
|
||||
FILESYSTEM_DISK=public
|
||||
|
||||
# AWS keys for S3 when using this storage method
|
||||
AWS_KEY=
|
||||
AWS_SECRET=
|
||||
AWS_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_SERVER=
|
||||
|
||||
# Set to true if you use S3 and need path style URL support for bucket access
|
||||
# The default is to use virtual-hosted style URLs which may not work everywhere
|
||||
S3_PATH_STYLE=
|
||||
|
||||
# Allow Two Factor Authentication feature on your instance
|
||||
MFA_ENABLED=true
|
||||
|
||||
# Enable DAV support
|
||||
DAV_ENABLED=true
|
||||
|
||||
# CLIENT ID and SECRET used for OAuth authentication
|
||||
PASSPORT_PASSWORD_GRANT_CLIENT_ID=
|
||||
PASSPORT_PASSWORD_GRANT_CLIENT_SECRET=
|
||||
|
||||
# Allow to access general statistics about your instance through a public API
|
||||
# call
|
||||
ALLOW_STATISTICS_THROUGH_PUBLIC_API_ACCESS=false
|
||||
|
||||
# Indicates that each user in the instance must comply to international policies
|
||||
# like CASL or GDPR
|
||||
POLICY_COMPLIANT=true
|
||||
|
||||
# Enable geolocation services
|
||||
# This is used to translate addresses to GPS coordinates.
|
||||
ENABLE_GEOLOCATION=false
|
||||
|
||||
# API key for geolocation services
|
||||
# We use LocationIQ (https://locationiq.com/) to translate addresses to
|
||||
# latitude/longitude coordinates. We could use Google instead but we don't
|
||||
# want to give anything to Google, ever.
|
||||
# LocationIQ offers 5000 free requests per day.
|
||||
LOCATION_IQ_API_KEY=
|
||||
|
||||
# Enable weather on contact profile page
|
||||
# Weather can only be fetched if we know longitude/latitude - this is why
|
||||
# you also need to activate the geolocation service above to make it work
|
||||
ENABLE_WEATHER=false
|
||||
|
||||
# Access to weather data from darksky api
|
||||
# https://www.weatherapi.com/signup.aspx
|
||||
# You need to enable the weather above if you provide an API key here.
|
||||
WEATHERAPI_KEY=
|
||||
|
||||
# Configure rate limits for RouteService per minute
|
||||
RATE_LIMIT_PER_MINUTE_API=60
|
||||
RATE_LIMIT_PER_MINUTE_OAUTH=5
|
||||
@@ -17,6 +17,7 @@ DB_USE_UTF8MB4=true
|
||||
QUEUE_CONNECTION=sync
|
||||
CACHE_DRIVER=database
|
||||
SESSION_DRIVER=file
|
||||
LOG_CHANNEL=stderr
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_DRIVER=log
|
||||
|
||||
96
.eslintrc.js
96
.eslintrc.js
@@ -1,96 +0,0 @@
|
||||
module.exports = {
|
||||
'env': {
|
||||
'browser': true,
|
||||
'es6': true,
|
||||
'cypress/globals': true
|
||||
},
|
||||
'extends': [
|
||||
'plugin:vue/recommended'
|
||||
],
|
||||
'parserOptions': {
|
||||
'ecmaVersion': 12,
|
||||
'sourceType': 'module'
|
||||
},
|
||||
'plugins': [
|
||||
'vue',
|
||||
'cypress'
|
||||
],
|
||||
'rules': {
|
||||
'array-bracket-spacing': [
|
||||
'error',
|
||||
'never'
|
||||
],
|
||||
'indent': [
|
||||
'error',
|
||||
2
|
||||
],
|
||||
'linebreak-style': [
|
||||
'error',
|
||||
'unix'
|
||||
],
|
||||
'no-trailing-spaces': [
|
||||
'error',
|
||||
{
|
||||
'ignoreComments': true,
|
||||
'skipBlankLines': true
|
||||
}
|
||||
],
|
||||
'quotes': [
|
||||
'error',
|
||||
'single'
|
||||
],
|
||||
'semi': [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
'semi-spacing': [
|
||||
'error',
|
||||
{
|
||||
'after': true,
|
||||
'before': false
|
||||
}
|
||||
],
|
||||
'semi-style': [
|
||||
'error',
|
||||
'last'
|
||||
],
|
||||
|
||||
// strongly recommended
|
||||
'vue/component-name-in-template-casing': [
|
||||
'error',
|
||||
'kebab-case'
|
||||
],
|
||||
'vue/component-tags-order': [
|
||||
'error', {
|
||||
'order': [
|
||||
'style',
|
||||
[
|
||||
'template',
|
||||
'script'
|
||||
]
|
||||
]
|
||||
}],
|
||||
'vue/html-end-tags' : 'error',
|
||||
'vue/html-self-closing': [
|
||||
'error',
|
||||
{
|
||||
'html': {
|
||||
'normal': 'never',
|
||||
'void': 'always'
|
||||
}
|
||||
}
|
||||
],
|
||||
'vue/no-v-html' : 0,
|
||||
'vue/max-attributes-per-line': [
|
||||
// https://vuejs.org/v2/style-guide/#Multi-attribute-elements-strongly-recommended
|
||||
'error',
|
||||
{
|
||||
'singleline': 5,
|
||||
'multiline': {
|
||||
'max': 5,
|
||||
'allowFirstLine': true
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
};
|
||||
24
.gitattributes
vendored
24
.gitattributes
vendored
@@ -1,24 +0,0 @@
|
||||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
*.js linguist-vendored
|
||||
/.github export-ignore
|
||||
/.platform export-ignore
|
||||
/.vscode export-ignore
|
||||
/tests export-ignore
|
||||
/scripts export-ignore
|
||||
.eslintrc.js export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.platform.app.yaml export-ignore
|
||||
.releaserc export-ignore
|
||||
.sass-lint.yml export-ignore
|
||||
.styleci.yml export-ignore
|
||||
crowdin.yml export-ignore
|
||||
cypress.json export-ignore
|
||||
phpstan.neon export-ignore
|
||||
phpunit.xml export-ignore
|
||||
psalm.yml export-ignore
|
||||
server.php export-ignore
|
||||
sonar-project.properties export-ignore
|
||||
template-definition.yaml export-ignore
|
||||
@@ -1,72 +0,0 @@
|
||||
name: Build & Push Monica Image to Gitea Registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
REGISTRY: localhost:3001
|
||||
REGISTRY_USER: MrDiderot
|
||||
REGISTRY_IMAGE: localhost:3001/mrdiderot/crm
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
shell: sh
|
||||
run: |
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "Docker CLI not found. Installing static binary..."
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz | tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -qO- https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz | tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||
else
|
||||
echo "Neither curl nor wget found! Attempting package manager install..."
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update && apt-get install -y docker.io
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add --no-cache docker-cli
|
||||
else
|
||||
echo "Cannot install Docker CLI!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Docker CLI already installed."
|
||||
fi
|
||||
docker --version
|
||||
|
||||
- name: Log in to Gitea Package Registry
|
||||
shell: sh
|
||||
run: |
|
||||
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
|
||||
echo "Missing REGISTRY_TOKEN secret."
|
||||
echo "Create a Gitea personal access token for MrDiderot with package Read and Write permission."
|
||||
exit 1
|
||||
fi
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ env.REGISTRY }}" -u "${{ env.REGISTRY_USER }}" --password-stdin
|
||||
|
||||
- name: Build and push Docker image
|
||||
shell: sh
|
||||
run: |
|
||||
echo "Workspace: $PWD"
|
||||
echo "Top-level files:"
|
||||
ls -la
|
||||
|
||||
if [ ! -f Dockerfile ]; then
|
||||
echo "Could not find root Dockerfile in workspace."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker build \
|
||||
-f Dockerfile \
|
||||
-t ${{ env.REGISTRY_IMAGE }}:latest \
|
||||
-t ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} \
|
||||
.
|
||||
docker push ${{ env.REGISTRY_IMAGE }}:latest
|
||||
docker push ${{ env.REGISTRY_IMAGE }}:${{ github.sha }}
|
||||
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
||||
github: [djaiss, asbiin]
|
||||
patreon: monicahq
|
||||
22
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
22
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@@ -1,22 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
(Note: you don't need to follow this template, nor to keep headlines or bold sentences - they are just there to guide you. Feel free to delete everything. We review every issue even if we don't immediately respond.)
|
||||
|
||||
Thanks for filing an issue and for your interest in the project.
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is. If your comment is `it doesn't work`, we won't know what to do with it.
|
||||
|
||||
**Screenshots**
|
||||
If you can, add screenshots to help explain your problem. An image is always helpful.
|
||||
**Which version are you using:**
|
||||
- Hosting version on https://app.monicahq.com
|
||||
- Mobile version
|
||||
- A server you maintain yourself (if so, please indicate your current version of Monica)
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
24
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
24
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
@@ -1,24 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
(Note: you don't need to follow this template, nor to keep headlines or bold sentences - they are just there to guide you. Feel free to delete everything. We review every issue even if we don't immediately respond.)
|
||||
|
||||
Thanks for filing an issue and for your interest in the project.
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex.
|
||||
* I'm always frustrated when [...]
|
||||
* Current feature X is awesome but doesn't fill the need of [...]
|
||||
* Monica doesn't have feature X which is essential as [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered (optional)**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here. The more context, the better.
|
||||
13
.github/ISSUE_TEMPLATE/General_issue.md
vendored
13
.github/ISSUE_TEMPLATE/General_issue.md
vendored
@@ -1,13 +0,0 @@
|
||||
---
|
||||
name: Feedback
|
||||
about: If you want to leave a general comment
|
||||
|
||||
---
|
||||
|
||||
(Note: you don't need to follow this template, nor to keep headlines or bold sentences - they are just there to guide you. Feel free to delete everything. We review every issue even if we don't immediately respond.)
|
||||
|
||||
Thanks for filing an issue and for your interest in the project.
|
||||
|
||||
If your issue is about a feature request, tell us why you need it.
|
||||
|
||||
If your issue is about a bug, please be as precise as possible in describing it.
|
||||
35
.github/PULL_REQUEST_TEMPLATE.md
vendored
35
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,35 +0,0 @@
|
||||
First of all thanks so much for taking the time to open a pull request and help the project. It's because of people like you that we love working on this project.
|
||||
|
||||
Please read the list below. Feel free to delete this text after but we need you to read it so we make sure that the project is consistent and remains of quality.
|
||||
|
||||
### Checklist
|
||||
|
||||
#### Before submitting the PR
|
||||
- [ ] Read the [CONTRIBUTING document](https://github.com/monicahq/monica/blob/main/CONTRIBUTING.md) before submitting your PR.
|
||||
- [ ] If the PR is related to an issue or fix one, don't forget to indicate it.
|
||||
- [ ] Create your PR as draft if it is not final yet. Mark it as ready... when it’s ready. Otherwise the PR will be considered complete and rejected if it's not working.
|
||||
|
||||
### General checks
|
||||
- [ ] Make sure that the change you propose is the smallest possible.
|
||||
- [ ] The name of the PR should follow the [conventional commits guideline](https://github.com/monicahq/monica/blob/main/docs/contribute/readme.md#conventional-commits) that the project follows.
|
||||
|
||||
### Front-end changes
|
||||
- [ ] If you change the UI, make sure to ask repositories administrators first about your changes by pinging djaiss or asbiin in this PR.
|
||||
- [ ] Screenshots are included if the PR changes the UI.
|
||||
- [ ] Front-end tests have been written with Cypress.
|
||||
|
||||
#### Backend/models changes
|
||||
- [ ] The API has been updated.
|
||||
- [ ] API's documentation has been added by submitting a pull request in the [marketing website repository](https://github.com/monicahq/marketing_site/pulls).
|
||||
- [ ] Tests have been added for the new code.
|
||||
- [ ] If you change a model, make sure the SetupTest file is updated. We need seeders to develop locally and generate fake data.
|
||||
|
||||
#### If the code changes the SQL schema
|
||||
- [ ] Make sure exporting account data as SQL is still working.
|
||||
- [ ] Make sure your changes do not break importing data with `vCard` and `.csv` files.
|
||||
- [ ] Make sure account reset and deletion still work.
|
||||
|
||||
#### Other tasks
|
||||
- [ ] [CONTRIBUTORS](https://github.com/monicahq/monica/blob/main/CONTRIBUTORS) entry added, if necessary.
|
||||
- [ ] If it's relevant and worth mentioning, create a changelog entry for this change. The changelog entry will appear inside the UI for all users to see. To know if your change is worth the creation of a changelog entry, [read the documentation](https://github.com/monicahq/monica/blob/main/docs/administrators/tips.md#when-is-it-relevant-to-create-a-changelog-entry).
|
||||
- [ ] Don't forget to [ask for a free account](mailto:regis@monicahq.com) on https://monicahq.com as anyone who contributes can request a free account.
|
||||
44
.github/dependabot.yml
vendored
44
.github/dependabot.yml
vendored
@@ -1,44 +0,0 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
time: "11:00"
|
||||
labels:
|
||||
- actions
|
||||
- dependencies
|
||||
- auto-squash
|
||||
|
||||
# Maintain dependencies for npm
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 10
|
||||
versioning-strategy: lockfile-only
|
||||
labels:
|
||||
- javascript
|
||||
- dependencies
|
||||
- auto-squash
|
||||
|
||||
# Maintain dependencies for Composer
|
||||
- package-ecosystem: composer
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 10
|
||||
versioning-strategy: lockfile-only
|
||||
ignore:
|
||||
- dependency-name: doctrine/dbal
|
||||
versions:
|
||||
- ">= 2.10.a"
|
||||
- "< 2.11"
|
||||
labels:
|
||||
- php
|
||||
- dependencies
|
||||
- auto-squash
|
||||
32
.gitignore
vendored
32
.gitignore
vendored
@@ -1,30 +1,6 @@
|
||||
.scannerwork/
|
||||
/node_modules
|
||||
/persist
|
||||
/public/css
|
||||
/public/fonts
|
||||
/public/hot
|
||||
/public/js
|
||||
/public/storage
|
||||
/public/mix-manifest.json
|
||||
/resources/vendor
|
||||
/results
|
||||
/storage/oauth-private.key
|
||||
/storage/oauth-public.key
|
||||
/tests/cypress/screenshots
|
||||
/tests/cypress/videos
|
||||
/vendor
|
||||
.composer
|
||||
.env
|
||||
.deploy.json
|
||||
.env.*
|
||||
!.env.mischlabs.example
|
||||
*.log
|
||||
.DS_Store
|
||||
.idea
|
||||
.phpunit.result.cache
|
||||
.sentry-release
|
||||
cypress.env.json
|
||||
Homestead.yaml
|
||||
Homestead.json
|
||||
monicadump.sql
|
||||
npm-debug.log*
|
||||
php-extensions-*.tar.bz2
|
||||
yarn-error.log
|
||||
Thumbs.db
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
# This file describes an application. You can have multiple applications
|
||||
# in the same project.
|
||||
|
||||
# The name of this app. Must be unique within a project.
|
||||
name: app
|
||||
|
||||
# The type of the application to build.
|
||||
type: php:8.1
|
||||
build:
|
||||
flavor: none
|
||||
|
||||
runtime:
|
||||
extensions:
|
||||
- apcu
|
||||
- gmp
|
||||
- redis
|
||||
- sodium
|
||||
|
||||
# The hooks that will be performed when the package is deployed.
|
||||
hooks:
|
||||
build: |
|
||||
set -evx
|
||||
composer install --no-interaction --no-dev
|
||||
composer require --update-no-dev platformsh/laravel-bridge
|
||||
mkdir -p ${SENTRY_ROOT:-/app/vendor/bin}
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=${SENTRY_ROOT:-/app/vendor/bin} bash
|
||||
deploy: |
|
||||
set -evx
|
||||
rm -f bootstrap/cache/*.php
|
||||
php artisan monica:update --force --skip-storage-link -vvv
|
||||
|
||||
# The relationships of the application with services or other applications.
|
||||
# The left-hand side is the name of the relationship as it will be exposed
|
||||
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
|
||||
# side is in the form `<service name>:<endpoint name>`.
|
||||
relationships:
|
||||
database: "db:mysql"
|
||||
rediscache: "cache:redis"
|
||||
redissession: "cache:redis"
|
||||
|
||||
# The size of the persistent disk of the application (in MB).
|
||||
disk: 512
|
||||
|
||||
# The mounts that will be performed when the package is deployed.
|
||||
mounts:
|
||||
"storage/app/public":
|
||||
source: local
|
||||
source_path: "public"
|
||||
"storage/app/temp":
|
||||
source: local
|
||||
source_path: "temp"
|
||||
"storage/framework/views":
|
||||
source: local
|
||||
source_path: "views"
|
||||
"storage/framework/sessions":
|
||||
source: local
|
||||
source_path: "sessions"
|
||||
"storage/framework/cache":
|
||||
source: local
|
||||
source_path: "cache"
|
||||
"storage/logs":
|
||||
source: local
|
||||
source_path: "logs"
|
||||
"bootstrap/cache":
|
||||
source: local
|
||||
source_path: "cache"
|
||||
"/.config":
|
||||
source: local
|
||||
source_path: "config"
|
||||
|
||||
# The configuration of app when it is exposed to the web.
|
||||
web:
|
||||
locations:
|
||||
"/":
|
||||
root: "public"
|
||||
index:
|
||||
- index.php
|
||||
allow: true
|
||||
passthru: "/index.php"
|
||||
|
||||
workers:
|
||||
queue:
|
||||
size: S
|
||||
commands:
|
||||
start: |
|
||||
php artisan queue:work --sleep=3 --tries=3 --queue=default,migration
|
||||
|
||||
crons:
|
||||
scheduler:
|
||||
spec: '*/5 * * * *'
|
||||
cmd: 'php artisan schedule:run -v'
|
||||
@@ -1,20 +0,0 @@
|
||||
# The routes of the project.
|
||||
#
|
||||
# Each route describes how an incoming URL is going
|
||||
# to be processed by Platform.sh.
|
||||
|
||||
"https://{default}/":
|
||||
type: upstream
|
||||
upstream: "app:http"
|
||||
"https://www.{default}/":
|
||||
type: redirect
|
||||
to: "https://{default}/"
|
||||
"https://{default}/.well-known/carddav":
|
||||
type: redirect
|
||||
to: "https://{default}/dav"
|
||||
"https://{default}/.well-known/caldav":
|
||||
type: redirect
|
||||
to: "https://{default}/dav"
|
||||
"https://{default}/.well-known/security.txt":
|
||||
type: redirect
|
||||
to: "https://{default}/security.txt"
|
||||
@@ -1,6 +0,0 @@
|
||||
db:
|
||||
type: mariadb:10.4
|
||||
disk: 2048
|
||||
|
||||
cache:
|
||||
type: redis:5.0
|
||||
38
.releaserc
38
.releaserc
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"branches": [
|
||||
"main",
|
||||
"4.x",
|
||||
"next",
|
||||
"next-major",
|
||||
{"name": "beta", "prerelease": true},
|
||||
{"name": "alpha", "prerelease": true}
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"releaseRules": [
|
||||
{"scope": "no-release", "release": false}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/release-notes-generator",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"writerOpts": {
|
||||
"commitGroupsSort": ["feat"],
|
||||
"commitsSort": ["scope", "subject"]
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "CHANGELOG.md"
|
||||
}
|
||||
],
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
options:
|
||||
formatter: stylish
|
||||
files:
|
||||
include: '**/*.s+(a|c)ss'
|
||||
rules:
|
||||
# Extends
|
||||
extends-before-mixins: 1
|
||||
extends-before-declarations: 1
|
||||
placeholder-in-extend: 1
|
||||
|
||||
# Mixins
|
||||
mixins-before-declarations: 1
|
||||
|
||||
# Line Spacing
|
||||
one-declaration-per-line: 1
|
||||
empty-line-between-blocks: 1
|
||||
single-line-per-selector: 1
|
||||
|
||||
# Disallows
|
||||
no-attribute-selectors: 0
|
||||
no-color-hex: 0
|
||||
no-color-keywords: 1
|
||||
no-color-literals: 0
|
||||
no-combinators: 0
|
||||
no-css-comments: 1
|
||||
no-debug: 1
|
||||
no-disallowed-properties: 0
|
||||
no-duplicate-properties: 1
|
||||
no-empty-rulesets: 1
|
||||
no-extends: 0
|
||||
no-ids: 1
|
||||
no-important: 1
|
||||
no-invalid-hex: 1
|
||||
no-mergeable-selectors: 1
|
||||
no-misspelled-properties: 1
|
||||
no-qualifying-elements: 1
|
||||
no-trailing-whitespace: 1
|
||||
no-trailing-zero: 1
|
||||
no-transition-all: 1
|
||||
no-universal-selectors: 0
|
||||
no-url-protocols: 1
|
||||
no-vendor-prefixes: 1
|
||||
no-warn: 1
|
||||
property-units: 0
|
||||
|
||||
# Nesting
|
||||
force-attribute-nesting: 3
|
||||
force-element-nesting: 1
|
||||
force-pseudo-nesting: 1
|
||||
|
||||
# Name Formats
|
||||
class-name-format: 1
|
||||
function-name-format: 1
|
||||
id-name-format: 0
|
||||
mixin-name-format: 1
|
||||
placeholder-name-format: 1
|
||||
variable-name-format: 1
|
||||
|
||||
# Style Guide
|
||||
attribute-quotes: 1
|
||||
bem-depth: 0
|
||||
border-zero: 1
|
||||
brace-style: 1
|
||||
clean-import-paths: 1
|
||||
empty-args: 1
|
||||
hex-length: 1
|
||||
hex-notation: 1
|
||||
indentation: 1
|
||||
leading-zero: 1
|
||||
nesting-depth:
|
||||
- 1
|
||||
-
|
||||
max-depth: 5
|
||||
property-sort-order: 1
|
||||
pseudo-element: 1
|
||||
quotes: 1
|
||||
shorthand-values: 1
|
||||
url-quotes: 1
|
||||
variable-for-property: 1
|
||||
zero-unit: 1
|
||||
|
||||
# Inner Spacing
|
||||
space-after-comma: 1
|
||||
space-before-colon: 1
|
||||
space-after-colon: 1
|
||||
space-before-brace: 1
|
||||
space-before-bang: 1
|
||||
space-after-bang: 1
|
||||
space-between-parens: 1
|
||||
space-around-operator: 1
|
||||
|
||||
# Final Items
|
||||
trailing-semicolon: 1
|
||||
final-newline: 1
|
||||
78
.snyk
78
.snyk
@@ -1,78 +0,0 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.14.1
|
||||
ignore: {}
|
||||
# patches apply the minimum changes required to fix a vulnerability
|
||||
patch:
|
||||
SNYK-JS-AXIOS-174505:
|
||||
- axios:
|
||||
patched: '2019-05-06T05:47:15.257Z'
|
||||
SNYK-JS-LODASH-450202:
|
||||
- cypress > lodash:
|
||||
patched: '2019-07-12T16:10:37.161Z'
|
||||
SNYK-JS-HTTPSPROXYAGENT-469131:
|
||||
- snyk > proxy-agent > https-proxy-agent:
|
||||
patched: '2019-10-04T05:47:03.270Z'
|
||||
- snyk > proxy-agent > pac-proxy-agent > https-proxy-agent:
|
||||
patched: '2019-10-04T05:47:03.270Z'
|
||||
SNYK-JS-TREEKILL-536781:
|
||||
- snyk > snyk-sbt-plugin > tree-kill:
|
||||
patched: '2019-12-12T05:47:36.247Z'
|
||||
SNYK-JS-LODASH-567746:
|
||||
- lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- cypress > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- eslint > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- mocha-multi-reporters > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- eslint > inquirer > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- eslint > table > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- eslint-plugin-vue > vue-eslint-parser > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- mocha > yargs-unparser > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/core > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > css-loader > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > webpack-merge > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-block-scoping > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > extract-text-webpack-plugin > async > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > optimize-css-assets-webpack-plugin > last-call-webpack-plugin > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > webpack-dev-server > http-proxy-middleware > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-modules-umd > @babel/helper-module-transforms > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > @babel/traverse > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > webpack-dev-server > portfinder > async > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-unicode-regex > @babel/helper-create-regexp-features-plugin > @babel/helper-regex > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > @babel/helpers > @babel/traverse > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-exponentiation-operator > @babel/helper-builder-binary-assignment-operator-visitor > @babel/helper-explode-assignable-expression > @babel/traverse > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > @babel/helpers > @babel/traverse > @babel/generator > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > @babel/helpers > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-exponentiation-operator > @babel/helper-builder-binary-assignment-operator-visitor > @babel/helper-explode-assignable-expression > @babel/traverse > @babel/generator > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-exponentiation-operator > @babel/helper-builder-binary-assignment-operator-visitor > @babel/helper-explode-assignable-expression > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > babel-merge > @babel/core > @babel/helpers > @babel/traverse > @babel/helper-function-name > @babel/helper-get-function-arity > @babel/types > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
- laravel-mix > @babel/preset-env > @babel/plugin-transform-exponentiation-operator > @babel/helper-builder-binary-assignment-operator-visitor > @babel/helper-explode-assignable-expression > @babel/traverse > @babel/helper-function-name > @babel/helper-get-function-arity > @babel/types > lodash:
|
||||
patched: '2020-04-30T15:46:03.231Z'
|
||||
11
.styleci.yml
11
.styleci.yml
@@ -1,11 +0,0 @@
|
||||
preset: laravel
|
||||
enabled:
|
||||
- length_ordered_imports
|
||||
- fully_qualified_strict_types
|
||||
disabled:
|
||||
- alpha_ordered_imports
|
||||
- no_useless_return
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
@@ -1,3 +0,0 @@
|
||||
php 8.1.0
|
||||
nodejs 16.15.0
|
||||
yarn 1.22.19
|
||||
1381
CHANGELOG.md
1381
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -1,51 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
We want everyone to be able to participate to our project no matter what they are or are from, as long as you don't bring drama or something irrelevant to the project. We are here to discuss Monica, its direction and the code around Monica - that's it. We will never judge someone, no matter the differences. On the contrary, we welcome differences. We will only judge the code that is submitted, and it will never be personal.
|
||||
|
||||
To summarize, don't be an ass - we are here to create something good, and something that is useful for the world. Don't bring your personal story and everything will be alright.
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* Discussion about politics, culture, gender, ethnicity,...
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at regis AT monicahq DOT com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
@@ -1,90 +0,0 @@
|
||||
## Contributing
|
||||
|
||||
First off, thank you for considering contributing to Monica. We need people like
|
||||
you to make Monica the best tool it can be.
|
||||
|
||||
Before you do anything else, please read the [README.md](README.md) of this project first.
|
||||
This is where we highlight the vision and the strategy. Please make sure you
|
||||
accept this vision before contributing to this project.
|
||||
|
||||
If you want to contribute to the translation / localization of Monica, please
|
||||
head over to [Crowdin](https://crowdin.com/project/monicahq) where we manage our
|
||||
localization files.
|
||||
|
||||
### 1. Where do I go from here?
|
||||
|
||||
If you've noticed a bug or have a question, [make an issue](https://github.com/monicahq/monica/issues/new),
|
||||
we'll try to answer it as fast as possible.
|
||||
|
||||
### 2. Fork & create a branch
|
||||
|
||||
If this is something you think you can fix, then
|
||||
[fork Monica](https://help.github.com/articles/fork-a-repo)
|
||||
and create a branch with a descriptive name.
|
||||
|
||||
A good branch name would be (where issue #325 is the ticket you're working on):
|
||||
|
||||
```sh
|
||||
git checkout -b 325-add-japanese-translations
|
||||
```
|
||||
|
||||
### 3. Get the test suite running
|
||||
|
||||
Make sure you follow the [instructions](https://github.com/monicahq/monica/blob/main/docs/contribute/readme.md#testing-environment)
|
||||
on how to setup the test suite.
|
||||
|
||||
### 4. Did you find a bug?
|
||||
|
||||
* **Ensure the bug was not already reported** by searching on GitHub under
|
||||
[Issues](https://github.com/monicahq/monica/issues).
|
||||
|
||||
* If you're unable to find an open issue addressing the problem,
|
||||
[open a new one](https://github.com/monicahq/monica/issues/new).
|
||||
Be sure to include a **title and clear description**, as much relevant
|
||||
information as possible, and a **code sample** or an **executable test case**
|
||||
demonstrating the expected behavior that is not occurring.
|
||||
|
||||
### 5. Implement your fix or feature
|
||||
|
||||
* At this point, you're ready to make your changes! Feel free to ask for help;
|
||||
everyone is a beginner at first :smile_cat:
|
||||
* Write a good commit message. To write good commit messages, please follow
|
||||
[those recommendations](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
||||
There are important to maintain an healthy commit logs.
|
||||
* We follow [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/)
|
||||
guideline in our Pull Request title. Please follow it: use the `feat` type
|
||||
for new features pull request, and `fix` type to fix a bug.
|
||||
* If there are multiple commits in your pull request, these commits will be
|
||||
squashed before merging. Please make sure, if that's the case, that your pull
|
||||
request has a nice description explaining what it does.
|
||||
* It's okay to have work-in-progress pull requests. Create a `draft` pull request
|
||||
if that's the case, otherwise your pull request will be
|
||||
considered in a state of being able to be merged as is.
|
||||
* If you wish to appear as a contributor, update the CONTRIBUTORS file and
|
||||
add your name to it. Include this change in your pull request.
|
||||
|
||||
### 6. Wait for the code to be reviewed
|
||||
|
||||
It can take several days before we can review the code you've submitted. We
|
||||
all have a lot of work to do and while we truly appreciate pull requests that
|
||||
are submitted, we can't review them instantly. We'll do our best to review
|
||||
them as fast as possible, but there are only 24 hours in a day and we can't
|
||||
sometimes be as fast as we wish we were. Moreover, there are little chances that
|
||||
the PR will be reviewed over the weekend, a time dedicated to spend time with
|
||||
friends and families (those you manage with Monica anyway :-)).
|
||||
|
||||
Also, keep in mind that this project is still a side project. Maintainers of
|
||||
this project are not paid to work on it. Everything they do, is done during
|
||||
their time off of their "real" job, that means at night, on the weekend and
|
||||
during holidays.
|
||||
|
||||
### 7. What can I contribute to?
|
||||
|
||||
Even the simplest change is appreciated. It can be a typo error, translating the
|
||||
application in a new language, fix a bug. No change is too small.
|
||||
|
||||
* If your contribution involves a change in the UI (even if it's very small),
|
||||
please ping @djaiss in an issue *before* you start working on it, explaining
|
||||
what you want to achieve, why and how. We want to maintain a high level of
|
||||
visual quality in the software and we will dismiss all pull requests that change
|
||||
the front end that have not been discussed before-hand.
|
||||
63
CONTRIBUTORS
63
CONTRIBUTORS
@@ -1,63 +0,0 @@
|
||||
This is the list of all the people that make this great software.
|
||||
Add yourself at the bottom of the list if you do contribute and wish
|
||||
to appear as a contributor. At the very minimum, the GitHub username
|
||||
is required if you do wish to appear. Other fields are optional.
|
||||
|
||||
Format: Firstname Lastname @github-handle <email>
|
||||
|
||||
CONTRIBUTORS
|
||||
------------
|
||||
Maazarin @djaiss
|
||||
Alexis Saettler @asbiin <alexis@saettler.org>
|
||||
Kirk Strauser @kstrauser
|
||||
Taryn Hill @Phrohdoh <taryn@phrohdoh.com>
|
||||
Andreas Zweili @Nebucatnetzer
|
||||
Kadir Yamamoto @yamakadi
|
||||
Rocco Palladino @rpalladino
|
||||
Sebastian Gumprich @rndmh3ro
|
||||
Brendan Butts @sevenecks <bbutts@stormcode.net>
|
||||
Christian Fratta @hherebus
|
||||
Jaroslav Lichtblau @svetlemodry
|
||||
Lee Fenlan @themodem <lee@fenlan.uk>
|
||||
Aaron Johnson @aejnsn
|
||||
David Egan @degan6 <dwe@eganrm.com>
|
||||
Scott Williams @scott-joe
|
||||
Craig Davison @davisonio <craig@davison.io>
|
||||
Michael Heap @mheap <m@michaelheap.com>
|
||||
Matthew Du Pont @mattdp <monica@matthewfdupont.com>
|
||||
Kovah @kovah <contact@kovah.de>
|
||||
Steven Maguire @stevenmaguire <stevenmaguire@gmail.com>
|
||||
@erdmenchen
|
||||
Tom Rochette @tomzx <tom@tomrochette.com>
|
||||
Roland Szabo @rolisz <rolisz@gmail.com>
|
||||
Theo Mathieu @Mokto
|
||||
Daniel Pieper @danielpieper <monica@daniel-pieper.com>
|
||||
Andrew Paul Smith <github@chucklesthebeard.com>
|
||||
Brian Clemens <brian@tiuxo.com>
|
||||
Christopher Zentgraf @TheZenti <git@the-zenti.de>
|
||||
Lorenzo L. Ancora @LorenzoAncora <admin@lorenzoancora.info>
|
||||
Ben Dauphinee @bendauphinee <me@bendauphinee.com>
|
||||
Benjamin Dowson @lattlay <bdowson7@gmail.com>
|
||||
Stuart Johnston @mechanarchy
|
||||
Bryan Kam @lydgate
|
||||
Tom Granot @TomGranot
|
||||
Chris Forrence @chrisforrence
|
||||
Mohammed Al-Sahaf @Mohammed90
|
||||
Ivan Kruchkoff @ivankruchkoff <ivan@kruchkoff.com>
|
||||
Joaquim Monserrat @jeremies
|
||||
Jack Kuo @JackKuo-tw <jackkuo@jackkuo.org>
|
||||
Russell Ault @RussellAult
|
||||
Martijn van der Ven @Zegnat <martijn@vanderven.se>
|
||||
Matthew Fitzgerald @mfitzgerald2 <matt@mfitz.net>
|
||||
Simon Van Accoleyen @SimonVanacco <simon@vanacco.fr>
|
||||
Michael Bianco <mike@mikebian.co>
|
||||
Ben Fesili @benfes
|
||||
Markus Dick @markusdick
|
||||
Jacek Sawoszczuk @jsawo
|
||||
Dung Nguyen @nhymxu
|
||||
Krzysztof Rewak @krzysztofrewak
|
||||
Geidson Benicio @geidsonc
|
||||
Maximilian Arzberger @Schlauer-Hax <hax@bbn.family>
|
||||
Gregor Bigalke @GregTCLTK <greg@bbn.family>
|
||||
Julián Garcés Rodríguez <juliangarces.jg@gmail.com>
|
||||
Alberto Cuevas Ocegueda <mexslacker@gmail.com>
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM monica:4-apache
|
||||
|
||||
LABEL org.opencontainers.image.title="MischCRM" \
|
||||
org.opencontainers.image.description="MischLabs packaged Monica CRM image for Gitea Registry and Watchtower deployment." \
|
||||
org.opencontainers.image.source="https://git.mischlabs.de/MrDiderot/CRM"
|
||||
660
LICENSE.md
660
LICENSE.md
@@ -1,660 +0,0 @@
|
||||
### GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
### Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains
|
||||
free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing
|
||||
under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
### TERMS AND CONDITIONS
|
||||
|
||||
#### 0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds
|
||||
of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of
|
||||
an exact copy. The resulting work is called a "modified version" of
|
||||
the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user
|
||||
through a computer network, with no transfer of a copy, is not
|
||||
conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to
|
||||
the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
#### 1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for
|
||||
making modifications to it. "Object code" means any non-source form of
|
||||
a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can
|
||||
regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same
|
||||
work.
|
||||
|
||||
#### 2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey,
|
||||
without conditions so long as your license otherwise remains in force.
|
||||
You may convey covered works to others for the sole purpose of having
|
||||
them make modifications exclusively for you, or provide you with
|
||||
facilities for running those works, provided that you comply with the
|
||||
terms of this License in conveying all material for which you do not
|
||||
control copyright. Those thus making or running the covered works for
|
||||
you must do so exclusively on your behalf, under your direction and
|
||||
control, on terms that prohibit them from making any copies of your
|
||||
copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the
|
||||
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||
it unnecessary.
|
||||
|
||||
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such
|
||||
circumvention is effected by exercising rights under this License with
|
||||
respect to the covered work, and you disclaim any intention to limit
|
||||
operation or modification of the work as a means of enforcing, against
|
||||
the work's users, your or third parties' legal rights to forbid
|
||||
circumvention of technological measures.
|
||||
|
||||
#### 4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
#### 5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these
|
||||
conditions:
|
||||
|
||||
- a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
- b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under
|
||||
section 7. This requirement modifies the requirement in section 4
|
||||
to "keep intact all notices".
|
||||
- c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
- d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
#### 6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of
|
||||
sections 4 and 5, provided that you also convey the machine-readable
|
||||
Corresponding Source under the terms of this License, in one of these
|
||||
ways:
|
||||
|
||||
- a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
- b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the Corresponding
|
||||
Source from a network server at no charge.
|
||||
- c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
- d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
- e) Convey the object code using peer-to-peer transmission,
|
||||
provided you inform other peers where the object code and
|
||||
Corresponding Source of the work are being offered to the general
|
||||
public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal,
|
||||
family, or household purposes, or (2) anything designed or sold for
|
||||
incorporation into a dwelling. In determining whether a product is a
|
||||
consumer product, doubtful cases shall be resolved in favor of
|
||||
coverage. For a particular product received by a particular user,
|
||||
"normally used" refers to a typical or common use of that class of
|
||||
product, regardless of the status of the particular user or of the way
|
||||
in which the particular user actually uses, or expects or is expected
|
||||
to use, the product. A product is a consumer product regardless of
|
||||
whether the product has substantial commercial, industrial or
|
||||
non-consumer uses, unless such uses represent the only significant
|
||||
mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to
|
||||
install and execute modified versions of a covered work in that User
|
||||
Product from a modified version of its Corresponding Source. The
|
||||
information must suffice to ensure that the continued functioning of
|
||||
the modified object code is in no case prevented or interfered with
|
||||
solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or
|
||||
updates for a work that has been modified or installed by the
|
||||
recipient, or for the User Product in which it has been modified or
|
||||
installed. Access to a network may be denied when the modification
|
||||
itself materially and adversely affects the operation of the network
|
||||
or violates the rules and protocols for communication across the
|
||||
network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
#### 7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders
|
||||
of that material) supplement the terms of this License with terms:
|
||||
|
||||
- a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
- b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
- c) Prohibiting misrepresentation of the origin of that material,
|
||||
or requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
- d) Limiting the use for publicity purposes of names of licensors
|
||||
or authors of the material; or
|
||||
- e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
- f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions
|
||||
of it) with contractual assumptions of liability to the recipient,
|
||||
for any liability that these contractual assumptions directly
|
||||
impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions; the
|
||||
above requirements apply either way.
|
||||
|
||||
#### 8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
#### 9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run
|
||||
a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
#### 10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
#### 11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned
|
||||
or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the
|
||||
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||
the non-exercise of one or more of the rights that are specifically
|
||||
granted under this License. You may not convey a covered work if you
|
||||
are a party to an arrangement with a third party that is in the
|
||||
business of distributing software, under which you make payment to the
|
||||
third party based on the extent of your activity of conveying the
|
||||
work, and under which the third party grants, to any of the parties
|
||||
who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by
|
||||
you (or copies made from those copies), or (b) primarily for and in
|
||||
connection with specific products or compilations that contain the
|
||||
covered work, unless you entered into that arrangement, or that patent
|
||||
license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
#### 12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under
|
||||
this License and any other pertinent obligations, then as a
|
||||
consequence you may not convey it at all. For example, if you agree to
|
||||
terms that obligate you to collect a royalty for further conveying
|
||||
from those to whom you convey the Program, the only way you could
|
||||
satisfy both those terms and this License would be to refrain entirely
|
||||
from conveying the Program.
|
||||
|
||||
#### 13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your
|
||||
version supports such interaction) an opportunity to receive the
|
||||
Corresponding Source of your version by providing access to the
|
||||
Corresponding Source from a network server at no charge, through some
|
||||
standard or customary means of facilitating copying of software. This
|
||||
Corresponding Source shall include the Corresponding Source for any
|
||||
work covered by version 3 of the GNU General Public License that is
|
||||
incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
#### 14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Affero General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever
|
||||
published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions
|
||||
of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
#### 15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
#### 16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
#### 17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
### How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively state
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
The software is called Monica and is a personal relationship management system.
|
||||
Copyright (C) 2016-2022 Maazarin
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper
|
||||
mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for
|
||||
the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. For more information on this, and how to apply and follow
|
||||
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||
@@ -1,19 +1,19 @@
|
||||
# MischLabs Monica Deployment
|
||||
|
||||
This repository is the MischLabs fork of Monica CRM, based on the upstream `monicahq/monica` `4.x` branch.
|
||||
This repository now acts as the MischLabs deployment repository for Monica CRM.
|
||||
The NAS runs the official Docker image directly instead of building and pushing a custom image through Gitea.
|
||||
|
||||
## Repository and Image
|
||||
|
||||
- Gitea repository: `https://git.mischlabs.de/MrDiderot/CRM.git`
|
||||
- Upstream base: `https://github.com/monicahq/monica`, branch `4.x`
|
||||
- NAS-internal registry image: `localhost:3001/mrdiderot/crm:latest`
|
||||
- Public Gitea package UI: `https://git.mischlabs.de/MrDiderot/-/packages/container/crm/latest`
|
||||
- Runtime image: `monica:4-apache`
|
||||
- NAS path: `/volume2/docker/mischcrm`
|
||||
- Default NAS port: `38090:80`
|
||||
- Public URL: `https://crm.mischlabs.de`
|
||||
|
||||
## Architecture
|
||||
|
||||
The NAS does not build the image locally. Gitea Actions builds a MischLabs package image from the official Monica Apache image and pushes it to the local Gitea registry through `localhost:3001`. This avoids Cloudflare upload limits for large Docker layers. The NAS runs:
|
||||
The NAS pulls Monica directly from Docker Hub. This avoids Cloudflare upload limits for large Docker layers and keeps the setup simple.
|
||||
|
||||
- `mischcrm`: Monica Apache web container
|
||||
- `mischcrm_cron`: Monica scheduler container using `cron.sh`
|
||||
@@ -42,7 +42,7 @@ Edit `.env`:
|
||||
|
||||
- `APP_KEY` must be `base64:<openssl rand -base64 32 output>`
|
||||
- `DB_PASSWORD` must be the long random hex password
|
||||
- `APP_URL` must match the public reverse proxy URL, for example `https://crm.mischlabs.de`
|
||||
- `APP_URL` must be `https://crm.mischlabs.de`
|
||||
|
||||
Then start:
|
||||
|
||||
@@ -60,7 +60,7 @@ docker logs mischcrm --tail=120
|
||||
|
||||
## Updates
|
||||
|
||||
Watchtower should update `localhost:3001/mrdiderot/crm:latest` automatically after Gitea Actions pushes a new image.
|
||||
Watchtower updates `monica:4-apache` directly from Docker Hub.
|
||||
|
||||
Manual update:
|
||||
|
||||
@@ -75,10 +75,10 @@ docker compose up -d
|
||||
|
||||
Do not commit `.env`.
|
||||
|
||||
Do not delete the Docker volumes unless you explicitly want to remove Monica data.
|
||||
Do not delete Docker volumes unless you explicitly want to remove Monica data.
|
||||
|
||||
If Monica redirects incorrectly behind Cloudflare, check:
|
||||
|
||||
- `APP_URL`
|
||||
- `APP_TRUSTED_PROXIES=*`
|
||||
- reverse proxy target port `38090`
|
||||
- Cloudflare tunnel target port `38090`
|
||||
|
||||
3
Procfile
3
Procfile
@@ -1,3 +0,0 @@
|
||||
web: vendor/bin/heroku-php-nginx -C nginx_app.conf /public
|
||||
queue: php artisan queue:work --sleep=3 --tries=3
|
||||
release: php artisan monica:update --force -vvv
|
||||
321
README.md
321
README.md
@@ -1,318 +1,13 @@
|
||||
# MischLabs Monica Fork
|
||||
# MischCRM
|
||||
|
||||
This repository is the MischLabs-hosted fork of Monica CRM. For deployment on MischNAS via Gitea Registry and Watchtower, see [`MISCHLABS_DEPLOYMENT.md`](MISCHLABS_DEPLOYMENT.md).
|
||||
MischCRM is the MischLabs deployment configuration for Monica CRM.
|
||||
|
||||
The upstream Monica README follows below.
|
||||
It intentionally uses the official Docker image directly:
|
||||
|
||||
<p align="center">
|
||||
```text
|
||||
monica:4-apache
|
||||
```
|
||||
|
||||

|
||||
There is no custom image build and no Gitea Actions workflow. This avoids Cloudflare upload limits for large Docker layers and keeps Watchtower updates simple.
|
||||
|
||||
<p>
|
||||
<h1 align="center">Personal Relationship Manager</h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/monicahq/monica/actions)
|
||||
[](https://hub.docker.com/_/monica/)
|
||||

|
||||
[](https://sonarcloud.io/project/activity?custom_metrics=coverage&graph=custom&id=monica)
|
||||
[](https://github.com/monicahq/monica/blob/main/LICENSE.md)
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
Monica is a great open source personal relationship management system.
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Purpose](#purpose)
|
||||
- [Features](#features)
|
||||
- [Who is it for?](#who-is-it-for)
|
||||
- [What Monica isn’t](#what-monica-isnt)
|
||||
- [Where does this tool come from?](#where-does-this-tool-come-from)
|
||||
- [Get started](#get-started)
|
||||
- [Requirements](#requirements)
|
||||
- [Update your instance](#update-your-instance)
|
||||
- [Contribute](#contribute)
|
||||
- [Contribute as a community](#contribute-as-a-community)
|
||||
- [Contribute as a developer](#contribute-as-a-developer)
|
||||
- [Principles, vision, goals and strategy](#principles-vision-goals-and-strategy)
|
||||
- [Principles](#principles)
|
||||
- [Vision](#vision)
|
||||
- [Goals](#goals)
|
||||
- [Strategy](#strategy)
|
||||
- [Monetization](#monetization)
|
||||
- [Why Open Source?](#why-open-source)
|
||||
- [Patreon](#patreon)
|
||||
- [Contact](#contact)
|
||||
- [Team](#team)
|
||||
- [Thank you, open source](#thank-you-open-source)
|
||||
- [License](#license)
|
||||
|
||||
## Introduction
|
||||
|
||||
Monica is an open-source web application to organize and record your interactions with your loved ones. We call it a PRM, or Personal Relationship Management. Think of it as a [CRM](https://en.wikipedia.org/wiki/Customer_relationship_management) (a popular tool used by sales teams in the corporate world) for your friends or family. This is what it currently looks like:
|
||||
|
||||
<p align="center">
|
||||
|
||||

|
||||
|
||||
</p>
|
||||
|
||||
### Purpose
|
||||
|
||||
Monica allows people to keep track of everything that’s important about their friends and family. Like the activities with them. When you last called someone and what you talked about. It will help you remember the name and the age of their kids. It can also remind you to call someone you haven’t talked to in a while.
|
||||
|
||||
### Features
|
||||
|
||||
* Add and manage contacts
|
||||
* Define relationships between contacts
|
||||
* Reminders
|
||||
* Automatic reminders for birthdays
|
||||
* Stay in touch with a contact by sending reminders at a given interval
|
||||
* Management of debts
|
||||
* Ability to add notes to a contact
|
||||
* Ability to record how you met someone
|
||||
* Management of activities with a contact
|
||||
* Management of tasks
|
||||
* Management of gifts given and received and ideas for gifts
|
||||
* Management of addresses and all the different ways to contact someone
|
||||
* Management of contact field types
|
||||
* Management of a contact’s pets
|
||||
* Basic journal
|
||||
* Ability to record how your day went
|
||||
* Upload documents and photos
|
||||
* Export and import of data
|
||||
* Export contacts as vCards
|
||||
* Ability to define custom genders
|
||||
* Ability to define custom activity types
|
||||
* Ability to favorite contacts
|
||||
* Track conversations on social media or SMS
|
||||
* Multiple users
|
||||
* Tags to organize contacts
|
||||
* Ability to define what section should appear on the contact sheet
|
||||
* Multiple currencies
|
||||
* Multiple languages
|
||||
* An API that covers most of the data
|
||||
|
||||
### Who is it for?
|
||||
|
||||
This project is **for people who have difficulty remembering details about other people’s lives** – especially those they care about. Yes, you can still use Facebook to achieve this, but you will only be able to see what people do and post, and not add your own notes about them.
|
||||
|
||||
We’ve also received lots of positive feedback from users who suffer from Asperger syndrome, Alzheimer’s disease, or simply introverts who use this application on a daily basis.
|
||||
|
||||
### What Monica isn’t
|
||||
|
||||
* Monica is not a social network and **it never will be**. It’s not meant to be social. It’s designed to be the opposite: it’s for your eyes only.
|
||||
* Monica is not a smart assistant. It won’t guess what you want to do. It’s actually pretty dumb: it will only send you emails for the things you asked to be reminded of.
|
||||
* Monica is not a tool that will scan your data and do nasty things with it. It’s your data, your server, do whatever you want with it. You’re in control of your data.
|
||||
|
||||
### Where does this tool come from?
|
||||
|
||||
I originally built this tool to help me in my private life: I’ve been living outside my own country for a long time now. I want to keep notes and remember the life of my friends in my home country and be able to ask the relevant questions when I email them or talk to them over the phone.
|
||||
|
||||
Moreover, as a foreigner in my new country, I met a lot of other foreigners – and most go back to their countries. I still want to remember the names or ages of their kids. You may call it cheating but considering my poor memory, I call it caring.
|
||||
|
||||
After a few months, I decided to open source Monica so it could help other people as well.
|
||||
|
||||
## Get started
|
||||
|
||||
There are multiple ways of getting started with Monica:
|
||||
|
||||
1. You can use [our Hosted version](https://monicahq.com "Monica website"). This is the simplest way to use Monica.
|
||||
1. You can install it on your own server by following the [installation instructions here](/docs/installation/readme.md). There are no limitations on Monica if you install it on your own server.
|
||||
|
||||
- The downloadable version will always be the most complete version – the same as offered on the paid plan on the Hosted version.
|
||||
- Self-hosted will always be completely free with no strings attached and you will be in complete control.
|
||||
|
||||
1. You can deploy straight on a [PaaS platform](https://en.wikipedia.org/wiki/Platform_as_a_service) like:
|
||||
|
||||
- Platform.sh [](https://console.platform.sh/projects/create-project/?template=https%3A%2F%2Fraw.githubusercontent.com%2Fmonicahq%2Fmonica%2Fmain%2F.platform.app.yaml&utm_campaign=deploy_on_platform&utm_medium=button&utm_source=affiliate_links&utm_content=https%3A%2F%2Fgithub.com%2Fmonicahq%2Fmonica)
|
||||
|
||||
- [Heroku](https://heroku.com) [](https://heroku.com/deploy?template=https://github.com/monicahq/monica/tree/4.x)
|
||||
|
||||
|
||||
### Requirements
|
||||
|
||||
If you want to host Monica yourself, you will need a server with:
|
||||
|
||||
- PHP 8.1 or newer
|
||||
- HTTP server with PHP support (eg: Apache, Nginx, Caddy)
|
||||
- Composer
|
||||
- MySQL
|
||||
|
||||
To successfully build and host Monica, we recommend a system with at least 1.5 GB for RAM. Monica can run on systems with significantly less memory, but due to the high memory requirements of the build process during updates, you may encounter issues and failed builds.
|
||||
|
||||
### Update your instance
|
||||
|
||||
Once the software is installed, you’ll need to update it from time to time to have access to the latest features. [Read this document](/docs/installation/update.md) to learn how to do it.
|
||||
|
||||
## Contribute
|
||||
|
||||
Do you want to help? That’s awesome. We welcome contributions of all kinds from everyone.
|
||||
|
||||
Here are some of the things you can do to help.
|
||||
|
||||
### Contribute as a community
|
||||
|
||||
- Unlike Fight Club, the best way to help is **to actually talk about Monica** as much as you can in blog posts and articles, or on Twitter and Facebook.
|
||||
|
||||
- You can answer questions in [the issue tracker](https://github.com/monicahq/monica/issues) to help other community members.
|
||||
|
||||
- You can financially support Monica’s development [on Patreon](https://www.patreon.com/monicahq) or by subscribing to [a paid account](https://monicahq.com/pricing).
|
||||
|
||||
### Contribute as a developer
|
||||
|
||||
- Read our [Contribution Guide](/CONTRIBUTING.md).
|
||||
|
||||
- Install [the developer version locally](/docs/contribute/readme.md) so you can start contributing.
|
||||
|
||||
- Look for [issues labelled ‘Bugs’](https://github.com/monicahq/monica/issues?q=is%3Aopen+is%3Aissue+label%3Abug) if you are looking to have an immediate impact on Monica.
|
||||
|
||||
- Look for [issues labelled ‘Help Wanted’](https://github.com/monicahq/monica/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). These are issues that you can solve relatively easily.
|
||||
|
||||
- Look for [issues labelled ’Good First Issue’](https://github.com/monicahq/monica/labels/good%20first%20issue). These issues are for people who want to contribute, but try to work on a small feature first.
|
||||
|
||||
- If you are an advanced developer, you can try to tackle [issues labelled ‘Feature Requests’](https://github.com/monicahq/monica/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature+request%22). These are harder to do and will require a lot of back-and-forth with the repository administrator to make sure we are going to the right direction with the product.
|
||||
|
||||
|
||||
## Principles, vision, goals and strategy
|
||||
|
||||
We want to use technology in a way that does not harm human relationships, like big social networks can do.
|
||||
|
||||
### Principles
|
||||
|
||||
Monica has a few principles.
|
||||
|
||||
- It should help have better relationships.
|
||||
|
||||
- It should be simple to use, simple to contribute to, simple to understand, extremely simple to maintain.
|
||||
|
||||
- It is not a social network and never will be.
|
||||
|
||||
- It is not and never will be ad-supported.
|
||||
|
||||
- Users are not and never will be tracked.
|
||||
|
||||
- It should be transparent.
|
||||
|
||||
- It should be open-source.
|
||||
|
||||
- It should do one thing (documenting social interactions) extremely well, and nothing more.
|
||||
|
||||
- It should be well documented.
|
||||
|
||||
### Vision
|
||||
|
||||
Monica’s vision is to **help people have more meaningful relationships**.
|
||||
|
||||
### Goals
|
||||
|
||||
We want to provide a platform that is:
|
||||
|
||||
- **really easy to use**: we value simplicity over anything else.
|
||||
|
||||
- **open-source**: we believe everyone should be able to contribute to this tool, and see for themselves that nothing nasty is done behind the scenes that would go against the best interests of the users. We also want to leverage the community to build attractive features and do things that would not be possible otherwise.
|
||||
|
||||
- **easy to contribute to**: we want to keep the codebase as simple as possible. This has two big advantages: anyone can contribute, and it’s easily maintainable on the long run.
|
||||
|
||||
- **available everywhere**: Monica should be able to run on any desktop OS or mobile phone easily. This will be made possible by making sure the tool is easily installable by anyone who wants to either contribute or host the platform themselves.
|
||||
|
||||
### Strategy
|
||||
|
||||
We think Monica has to become a platform more than an application, so people can build on it.
|
||||
|
||||
Here what we should do in order to realize our vision:
|
||||
|
||||
- (**done**) Build an API in order to create an ecosystem. The ecosystem is what will make Monica a successful platform.
|
||||
|
||||
- (**done**) Build importers and exporters of data. We don’t want to have any vendor lock-ins. Data is the property of the users and they should be able to do whatever they want with it.
|
||||
|
||||
- (**done**) Be the central point of contact management, by supporting CardDav protocol.
|
||||
|
||||
- (**done**) Be the central point of calendar events, by supporting CalDav protocol.
|
||||
|
||||
- (**partially done**) Build great reports so people can have interesting insights on how they interact with their loved ones.
|
||||
|
||||
- Create a smart recommendation system for gifts. For instance, if my nephew is soon 6 years old in a month, I will be able to receive an email with a list of 5 potential gifts I can offer to a 6 year old boy.
|
||||
|
||||
- Add more ways of being reminded: Telegram, SMS,...
|
||||
|
||||
- Create Chrome extensions to load Monica’s data in a sidebar when viewing a contact on Facebook, letting us take additional notes as we see them on Facebook.
|
||||
|
||||
- Add modules that can be activated on demand. One would be for instance, for the people who wants to use Monica for dating purposes (yes, we’ve received this kind of feedback already).
|
||||
|
||||
### Monetization
|
||||
|
||||
While it’s not the driving force behind Monica, it would be great if the tool could generate money so we could work full time on it and sustain it on the long run. We are big fans of [Sentry](https://sentry.io), Wordpress and GitLab and we believe this kind of business model is an inspiring one where everyone wins.
|
||||
|
||||
If you want to support the development of Monica, consider taking [a paid account](https://www.monicahq.com/pricing), or support us [on Patreon](https://www.patreon.com/monicahq).
|
||||
|
||||
- The [Hosted version of Monica](https://monicahq.com) is offered in two versions:
|
||||
|
||||
* a [free plan](https://app.monicahq.com/register) which includes:
|
||||
+ 10 contacts
|
||||
+ data exporters
|
||||
|
||||
* a [paid plan](https://www.monicahq.com/pricing) which includes:
|
||||
+ unlimited contacts
|
||||
+ email reminders
|
||||
+ data importers
|
||||
+ advanced features
|
||||
|
||||
* We’re still working on the features included in the paid plan, and these may be subject to change while we work out our business model to make Monica’s development sustainable.
|
||||
|
||||
* People who substantially contribute to the GitHub repository (with a pull request that adds value, that gets merged – not a typo fix, for instance) will also have access to the paid version for free.
|
||||
|
||||
- There is a [Patreon account](https://www.patreon.com/monicahq) for those who want to financially support Monica’s development in another way. The best way to support Monica it is to actually talk about it and help grow its userbase.
|
||||
|
||||
|
||||
There are no ads on the platform and there never will be. We will never resell your data on [the Hosted version](https://monicahq.com/) and we have no access to it if you self-host.
|
||||
|
||||
We are like you, and this is why we are on GitHub: we hate big corporations that do not have at heart the best interests of their users, even if they say otherwise. We believe that the only way to sustain the development of Monica is to actually make money in a good old-fashioned way.
|
||||
|
||||
### Why Open Source?
|
||||
|
||||
Why is Monica open source? Is it risky? Will someone steal my code and do a for-profit business that will kill my own business? Why reveal my strategy to the world? These are the kind of questions we’ve received by email already.
|
||||
|
||||
The answer to these questions is simple: yes, you can fork Monica and make a competing project, make money out of it (even if the license is not super friendly towards that) and I’ll never know. But it’s okay, I don’t mind.
|
||||
|
||||
I wanted to open source Monica for several reasons:
|
||||
|
||||
- **I believe that this tool can really change people’s lives.**
|
||||
While I aim to make money out of it, I also want everyone to benefit from it. Open sourcing a project like this will help Monica become much bigger than what I imagine myself. While I strongly believe that this software has to follow the vision I have for it, I need to be humble enough to know that ideas come from everywhere, and people have much better ideas than what I can have.
|
||||
|
||||
- **You can’t make something great alone.**
|
||||
While Monica could become a company and hire a bunch of super smart people to work on it, you can’t beat the manpower of an entire community. Open sourcing the product means bugs will be fixed faster, features will be developed faster, and more importantly, developers will be able to contribute to a tool that positively changes their own lives and the lives of other people.
|
||||
|
||||
- **Doing things in a transparent way leads to formidable things.**
|
||||
People respect the project more when they can see how it’s being worked on. You can’t hide nasty things in the code. You can’t do things behind the backs of your users. Doing everything in the open is a major driving force that motivates you to keep doing what’s right.
|
||||
|
||||
- **Once you’ve created a community of passionate developers around your project, you’ve won.**
|
||||
Because developers are very powerful influencers. Developers will create apps around your product, talk about it on forums, and share the project with their friends, families, and colleagues. Cherish the developers – users will follow.
|
||||
|
||||
### Patreon
|
||||
|
||||
You can support the development of Monica [on Patreon](https://www.patreon.com/monicahq). Thanks for your help.
|
||||
|
||||
## Contact
|
||||
|
||||
## Team
|
||||
|
||||
Our team is made of two core members:
|
||||
|
||||
- [Maazarin (djaiss)](https://github.com/djaiss)
|
||||
|
||||
- [Alexis Saettler (asbiin)](https://github.com/asbiin)
|
||||
|
||||
We are also fortunate to have an amazing [community of developers](https://github.com/monicahq/monica/graphs/contributors) who help us greatly.
|
||||
|
||||
## Thank you, open source
|
||||
|
||||
Monica uses a lot of open source projects and we thank them with all our hearts. We hope that providing Monica as an free, open source project will help other people the same way those softwares have helped us.
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2016–2022
|
||||
|
||||
Licensed under [the AGPL License](/LICENSE.md).
|
||||
See [`MISCHLABS_DEPLOYMENT.md`](MISCHLABS_DEPLOYMENT.md) for NAS setup and update commands.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover any security related issues, please email security@monicahq.com instead of using the issue tracker.
|
||||
74
app.json
74
app.json
@@ -1,74 +0,0 @@
|
||||
{
|
||||
"name": "Monica",
|
||||
"description": "Personal Relationship Manager - a new kind of CRM to manage your friends and family.",
|
||||
"repository": "https://github.com/monicahq/monica",
|
||||
"logo": "https://raw.githubusercontent.com/monicahq/monica/main/public/img/monica_60.png",
|
||||
"keywords": [
|
||||
"CRM",
|
||||
"family",
|
||||
"friends",
|
||||
"relationship",
|
||||
"PRM"
|
||||
],
|
||||
"buildpacks": [
|
||||
{
|
||||
"url": "heroku/php"
|
||||
},
|
||||
{
|
||||
"url": "heroku/nodejs"
|
||||
}
|
||||
],
|
||||
"addons": [
|
||||
{
|
||||
"plan": "jawsdb:kitefin"
|
||||
},
|
||||
{
|
||||
"plan": "scheduler:standard"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"postdeploy": "php artisan setup:production --force -vvv"
|
||||
},
|
||||
"env": {
|
||||
"APP_KEY": {
|
||||
"description": "Please change this to a 32-character string. For example run `echo -n 'base64:'; openssl rand -base64 32` and copy/paste the value.",
|
||||
"value": "change-me-to-a-random-string----"
|
||||
},
|
||||
"APP_URL": {
|
||||
"description": "Please change this to your Heroku app's domain.",
|
||||
"value": "https://XXX.herokuapp.com"
|
||||
},
|
||||
"APP_ENV": {
|
||||
"description": "Use monica in 'production' mode, or set it to 'local' if you want to install Monica as a development version.",
|
||||
"value": "production"
|
||||
},
|
||||
"APP_DISABLE_SIGNUP": {
|
||||
"description": "Disable user signup.",
|
||||
"value": "false"
|
||||
},
|
||||
"APP_DEBUG": {
|
||||
"description": "Enables or disables debug mode.",
|
||||
"value": "false"
|
||||
},
|
||||
"APP_EMAIL_NEW_USERS_NOTIFICATION": {
|
||||
"description": "",
|
||||
"value": "noreply@example.com"
|
||||
},
|
||||
"MAIL_FROM_ADDRESS": {
|
||||
"description": "",
|
||||
"value": "noreply@example.com"
|
||||
},
|
||||
"MAIL_FROM_NAME": {
|
||||
"description": "",
|
||||
"value": "Bob Smith"
|
||||
},
|
||||
"DB_CONNECTION": {
|
||||
"description": "Tells the application to use Heroku's database connection.",
|
||||
"value": "heroku"
|
||||
},
|
||||
"HEROKU": {
|
||||
"description": "Tells the application this application is hosted on Heroku.",
|
||||
"value": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Account\Account;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Instance\Statistic;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CalculateStatistics extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:calculatestatistics';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Calculate general usage statistics';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$statistic = new Statistic;
|
||||
$statistic->number_of_users = DB::table('users')->count();
|
||||
$statistic->number_of_contacts = DB::table('contacts')->count();
|
||||
$statistic->number_of_notes = DB::table('notes')->count();
|
||||
$statistic->number_of_reminders = DB::table('reminders')->count();
|
||||
$statistic->number_of_tasks = DB::table('tasks')->count();
|
||||
$statistic->number_of_invitations_sent = DB::table('accounts')->sum('number_of_invitations_sent');
|
||||
|
||||
// number_of_accounts_with_more_than_one_user
|
||||
$number_of_accounts_with_more_than_one_user = 0;
|
||||
foreach (Account::all() as $account) {
|
||||
if ($account->users()->count() > 1) {
|
||||
$number_of_accounts_with_more_than_one_user = $number_of_accounts_with_more_than_one_user + 1;
|
||||
}
|
||||
}
|
||||
$statistic->number_of_accounts_with_more_than_one_user = $number_of_accounts_with_more_than_one_user;
|
||||
$statistic->number_of_import_jobs = DB::table('import_jobs')->count();
|
||||
$statistic->number_of_tags = DB::table('tags')->count();
|
||||
$statistic->number_of_activities = DB::table('activities')->count();
|
||||
$statistic->number_of_addresses = DB::table('addresses')->count();
|
||||
$statistic->number_of_api_calls = DB::table('api_usage')->count();
|
||||
$statistic->number_of_calls = DB::table('calls')->count();
|
||||
$statistic->number_of_contact_fields = DB::table('contact_fields')->count();
|
||||
$statistic->number_of_contact_field_types = DB::table('contact_field_types')->count();
|
||||
$statistic->number_of_debts = DB::table('debts')->count();
|
||||
$statistic->number_of_entries = DB::table('entries')->count();
|
||||
$statistic->number_of_gifts = DB::table('gifts')->count();
|
||||
$statistic->number_of_oauth_access_tokens = DB::table('oauth_access_tokens')->count();
|
||||
$statistic->number_of_oauth_clients = DB::table('oauth_clients')->count();
|
||||
$statistic->number_of_relationships = DB::table('relationships')->count();
|
||||
$statistic->number_of_subscriptions = DB::table('subscriptions')->count();
|
||||
$statistic->number_of_conversations = DB::table('conversations')->count();
|
||||
$statistic->number_of_messages = DB::table('messages')->count();
|
||||
|
||||
$statistic->save();
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User\SyncToken;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Events\TokenDeleteEvent;
|
||||
use App\Services\Instance\TokenClean;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class Clean extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:clean
|
||||
{--dry-run : Do everything except actually clean monica instance.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Clean monica instance';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Event::listen(TokenDeleteEvent::class, function ($event) {
|
||||
$this->handleTokenDelete($event->token);
|
||||
});
|
||||
|
||||
app(TokenClean::class)->execute([
|
||||
'dryrun' => (bool) $this->option('dry-run'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle TokenDeleteEvent event.
|
||||
*
|
||||
* @param SyncToken $token
|
||||
*/
|
||||
private function handleTokenDelete($token)
|
||||
{
|
||||
$this->info('Delete token '.$token->id.' - User '.$token->user_id.' - Type '.$token->name.' - timestamp '.$token->timestamp);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Account\Account;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
|
||||
class CreateAccount extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'account:create
|
||||
{--email= : Login email for the account.}
|
||||
{--password= : Password to set for the account.}
|
||||
{--firstname= : First name for the account.}
|
||||
{--lastname= : Last name for the account.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new account';
|
||||
|
||||
/**
|
||||
* Missing argument errors. Exposed for testing.
|
||||
*/
|
||||
const ERROR_MISSING_EMAIL = '! You must specify an email';
|
||||
const ERROR_MISSING_PASSWORD = '! You must specify a password';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$email = $this->option('email');
|
||||
if (empty($email)) {
|
||||
$this->error($this::ERROR_MISSING_EMAIL);
|
||||
}
|
||||
|
||||
$password = $this->option('password');
|
||||
if (empty($password)) {
|
||||
$this->error($this::ERROR_MISSING_PASSWORD);
|
||||
}
|
||||
|
||||
$firstName = $this->option('firstname') ?? 'John';
|
||||
|
||||
$lastName = $this->option('lastname') ?? 'Doe';
|
||||
|
||||
if (empty($email) || empty($password)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->confirmToProceed('This will create a new user for '.$firstName.' '.$lastName.' with email '.$email)) {
|
||||
Account::createDefault($firstName, $lastName, $email, $password);
|
||||
|
||||
$this->info('| You can now sign in to your account:');
|
||||
$this->line('| username: '.$email);
|
||||
$this->line('| password: <hidden>');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\SynchronizeAddressBooks;
|
||||
use App\Models\Account\AddressBookSubscription;
|
||||
|
||||
class DavClientsUpdate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:davclients';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update all dav subscriptions';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$subscriptions = AddressBookSubscription::active()->get();
|
||||
|
||||
$now = now();
|
||||
$subscriptions->filter(function ($subscription) use ($now) {
|
||||
return $this->isTimeToRunSync($subscription, $now);
|
||||
})->each(function ($subscription) {
|
||||
SynchronizeAddressBooks::dispatch($subscription);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the last synchronized timestamp is older than the subscription's frequency time.
|
||||
*
|
||||
* @param AddressBookSubscription $subscription
|
||||
* @param Carbon $now
|
||||
* @return bool
|
||||
*/
|
||||
private function isTimeToRunSync(AddressBookSubscription $subscription, Carbon $now): bool
|
||||
{
|
||||
return is_null($subscription->last_synchronized_at)
|
||||
|| $subscription->last_synchronized_at->addMinutes($subscription->frequency)->lessThan($now);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Deactivate2FA extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = '2fa:deactivate
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--email= : The email of the user to deactivate 2FA.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Deactivate 2FA for this user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// retrieve the email from the option
|
||||
$email = $this->option('email');
|
||||
|
||||
// if no email was passed to the option, prompt the user to enter the email
|
||||
if (! $email) {
|
||||
$email = $this->ask('what is the user\'s email?');
|
||||
}
|
||||
|
||||
// retrieve the user with the specified email
|
||||
$user = User::where('email', $email)->first();
|
||||
|
||||
if (! $user) {
|
||||
// show an error and exist if the user does not exist
|
||||
$this->error('No user with that email.');
|
||||
|
||||
return;
|
||||
}
|
||||
if (is_null($user->google2fa_secret)) {
|
||||
// show an error and exist if the user does not exist
|
||||
$this->error('2FA is currently not activated for this user.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Print a warning
|
||||
$this->info('2FA will be deactivated for '.$user->email);
|
||||
$this->info('This action can\'t be cancelled.');
|
||||
|
||||
// ask for confirmation if not forced
|
||||
if (! $this->option('force') && ! $this->confirm('Do you wish to continue?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove google2fa_secret key
|
||||
$user->google2fa_secret = null;
|
||||
|
||||
// save the user
|
||||
$user->save();
|
||||
|
||||
// show the new secret key
|
||||
$this->info('2FA has been deactivated for '.$user->email);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\ExportAllAsSQL;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ExportAll extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'export:all';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Exports all data as SQL to storage/app';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$job = new ExportAllAsSQL();
|
||||
$this->info('Exported as '.$job->handle().'');
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class GetVersion extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:getversion';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Get current version of monica';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$this->line(config('monica.app_version'));
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Helpers;
|
||||
|
||||
use Tests\Helpers\CommandCallerFake;
|
||||
|
||||
/**
|
||||
* @method static void exec(\Illuminate\Console\Command $command, string $message, string $commandline)
|
||||
* @method static void artisan(\Illuminate\Console\Command $command, string $message, string $commandline, array $arguments)
|
||||
*/
|
||||
class Command
|
||||
{
|
||||
/**
|
||||
* Switch to a fake executor for testing purpose.
|
||||
*
|
||||
* @return CommandCallerContract
|
||||
*/
|
||||
public static function fake(): CommandCallerContract
|
||||
{
|
||||
static::setBackend($fake = app(CommandCallerFake::class));
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Command Executor.
|
||||
*
|
||||
* @var CommandCallerContract|null
|
||||
*/
|
||||
private static $commandCaller;
|
||||
|
||||
/**
|
||||
* Get the current backend command.
|
||||
*
|
||||
* @return CommandCallerContract
|
||||
*/
|
||||
private static function getBackend(): CommandCallerContract
|
||||
{
|
||||
if (! static::$commandCaller) {
|
||||
static::$commandCaller = app(CommandCaller::class); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return static::$commandCaller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current backend command.
|
||||
*
|
||||
* @param CommandCallerContract $executor
|
||||
*/
|
||||
public static function setBackend(CommandCallerContract $executor): void
|
||||
{
|
||||
static::$commandCaller = $executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic, static calls to the object.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function __callStatic($method, $args)
|
||||
{
|
||||
$instance = static::getBackend();
|
||||
|
||||
return $instance->$method(...$args);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Helpers;
|
||||
|
||||
use function Safe\exec;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\Application;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class CommandCaller implements CommandCallerContract
|
||||
{
|
||||
/**
|
||||
* Print a message on the console, then execute a command.
|
||||
*
|
||||
* @param Command $command Laravel command context
|
||||
* @param string $message Message to output
|
||||
* @param string $commandline Command to execute
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function exec(Command $command, string $message, string $commandline): void
|
||||
{
|
||||
$command->info($message);
|
||||
$command->line($commandline, null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
exec($commandline.' 2>&1', $output);
|
||||
foreach ($output as $line) {
|
||||
$command->line($line, null, OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
}
|
||||
$command->line('', null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a message on the console, then execute an artisan command.
|
||||
*
|
||||
* @param Command $command Laravel command context
|
||||
* @param string $message Message to output
|
||||
* @param string $commandline Artisan command name to execute
|
||||
* @param array $arguments Optional arguments to pass to the artisan command
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function artisan(Command $command, string $message, string $commandline, array $arguments = []): void
|
||||
{
|
||||
$info = '';
|
||||
foreach ($arguments as $key => $value) {
|
||||
if (is_string($key)) {
|
||||
$info .= ' '.$key.'="'.$value.'"';
|
||||
} else {
|
||||
$info .= ' '.$value;
|
||||
}
|
||||
}
|
||||
$this->exec($command, $message, Application::formatCommandString($commandline.$info));
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Helpers;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
interface CommandCallerContract
|
||||
{
|
||||
/**
|
||||
* Print a message on the console, then execute a command.
|
||||
*
|
||||
* @param Command $command Laravel command context
|
||||
* @param string $message Message to output
|
||||
* @param string $commandline Command to execute
|
||||
*/
|
||||
public function exec(Command $command, string $message, string $commandline): void;
|
||||
|
||||
/**
|
||||
* Print a message on the console, then execute an artisan command.
|
||||
*
|
||||
* @param Command $command Laravel command context
|
||||
* @param string $message Message to output
|
||||
* @param string $commandline Artisan command name to execute
|
||||
* @param array $arguments Optional arguments to pass to the artisan command
|
||||
*/
|
||||
public function artisan(Command $command, string $message, string $commandline, array $arguments = []): void;
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Account\Account;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ImportAccounts extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'account:import_ldap
|
||||
{--ldap_uri= : LDAP URI.}
|
||||
{--ldap_user= : LDAP Bind DN.}
|
||||
{--ldap_pass= : LDAP Bind Password.}
|
||||
{--ldap_base= : LDAP base DN for searching.}
|
||||
{--ldap_filter= : Filter to search for user accounts.}
|
||||
{--ldap_attr_mail= : LDAP attribute to map to email (default: mail).}
|
||||
{--ldap_attr_firstname= : LDAP attribute to map to firstname (default: gn).}
|
||||
{--ldap_attr_lastname= : LDAP attribute to map to lastname (default: sn).}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Import user accounts from LDAP';
|
||||
|
||||
/**
|
||||
* Missing argument errors. Exposed for testing.
|
||||
*/
|
||||
const ERROR_MISSING_LDAP_FILTER = '! You must specify an LDAP Filter';
|
||||
const ERROR_MISSING_LDAP_BASE = '! You must specify an LDAP Base';
|
||||
const ERROR_MISSING_LDAP_USER = '! You must specify an LDAP User';
|
||||
const ERROR_MISSING_LDAP_PASS = '! You must specify an LDAP Password';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$ldap_uri = $this->option('ldap_uri') ?? '127.0.0.1';
|
||||
$ldap_attr_mail = $this->option('ldap_attr_mail') ?? 'mail';
|
||||
$ldap_attr_firstname = $this->option('ldap_attr_firstname') ?? 'givenName';
|
||||
$ldap_attr_lastname = $this->option('ldap_attr_lastname') ?? 'sn';
|
||||
|
||||
$ldap_user = $this->option('ldap_user');
|
||||
if (empty($ldap_user)) {
|
||||
$this->error($this::ERROR_MISSING_LDAP_USER);
|
||||
}
|
||||
|
||||
$ldap_pass = $this->option('ldap_pass');
|
||||
if (empty($ldap_pass)) {
|
||||
$this->error($this::ERROR_MISSING_LDAP_PASS);
|
||||
}
|
||||
|
||||
$ldap_base = $this->option('ldap_base');
|
||||
if (empty($ldap_base)) {
|
||||
$this->error($this::ERROR_MISSING_LDAP_BASE);
|
||||
}
|
||||
|
||||
$ldap_filter = $this->option('ldap_filter');
|
||||
if (empty($ldap_filter)) {
|
||||
$this->error($this::ERROR_MISSING_LDAP_FILTER);
|
||||
}
|
||||
|
||||
if (empty($ldap_user) || empty($ldap_pass) || empty($ldap_base) || empty($ldap_filter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ldap_conn = ldap_connect($ldap_uri);
|
||||
if (! $ldap_conn) {
|
||||
$this->error('Could not connect to LDAP URI');
|
||||
|
||||
return;
|
||||
}
|
||||
if (! ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
|
||||
$this->error('Could not set LDAP protocol v3');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$bind = ldap_bind($ldap_conn, $ldap_user, $ldap_pass);
|
||||
if (! $bind) {
|
||||
$this->error('Could not bind with given LDAP credentials');
|
||||
|
||||
return;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$ldap_res = [];
|
||||
try {
|
||||
$ldap_res = ldap_search($ldap_conn, $ldap_base, $ldap_filter, [$ldap_attr_mail, $ldap_attr_firstname, $ldap_attr_lastname]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$ldap_data = ldap_get_entries($ldap_conn, $ldap_res);
|
||||
|
||||
for ($i = 0; $i < $ldap_data['count']; $i++) {
|
||||
if (! (isset($ldap_data[$i][$ldap_attr_mail]) && $ldap_data[$i][$ldap_attr_mail]['count'] > 0)) {
|
||||
continue;
|
||||
}
|
||||
$user_mail = $ldap_data[$i][$ldap_attr_mail][0];
|
||||
$user_firstname = 'John';
|
||||
$user_lastname = 'Doe';
|
||||
$user_password = bin2hex(random_bytes(64));
|
||||
if (isset($ldap_data[$i][$ldap_attr_firstname]) && $ldap_data[$i][$ldap_attr_firstname]['count'] > 0) {
|
||||
$user_firstname = $ldap_data[$i][$ldap_attr_firstname][0];
|
||||
}
|
||||
if (isset($ldap_data[$i][$ldap_attr_lastname]) && $ldap_data[$i][$ldap_attr_lastname]['count'] > 0) {
|
||||
$user_lastname = $ldap_data[$i][$ldap_attr_lastname][0];
|
||||
}
|
||||
$this->info('Importing user "'.$user_mail.'"');
|
||||
try {
|
||||
Account::createDefault($user_firstname, $user_lastname, $user_mail, $user_password);
|
||||
} catch (\Exception $import_error) {
|
||||
$this->warn('Could not import user "'.$user_mail.'": '.$import_error->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use function Safe\fopen;
|
||||
use App\Models\User\User;
|
||||
use function Safe\fclose;
|
||||
use App\Helpers\DateHelper;
|
||||
use App\Models\Contact\Gender;
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Contact\ContactField;
|
||||
use App\Models\Contact\ContactFieldType;
|
||||
use App\Jobs\Avatars\GetAvatarsFromInternet;
|
||||
use App\Services\Contact\Address\CreateAddress;
|
||||
use App\Services\Contact\Reminder\CreateReminder;
|
||||
|
||||
class ImportCSV extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'import:csv {user : email or id of a user} {file : path to the CSV file} {--format=google}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Imports CSV in Google format to user account';
|
||||
|
||||
/**
|
||||
* The contact field email object.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $contactFieldEmailId;
|
||||
|
||||
/**
|
||||
* The contact field phone object.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $contactFieldPhoneId;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$file = $this->argument('file');
|
||||
|
||||
if (is_numeric($this->argument('user'))) {
|
||||
$user = User::find($this->argument('user'));
|
||||
} else {
|
||||
$user = User::where('email', $this->argument('user'))->first();
|
||||
}
|
||||
|
||||
if (! $user) {
|
||||
$this->error('You need to provide a valid User ID or email address!');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! file_exists($file)) {
|
||||
$this->error('You need to provide a valid file path.');
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (is_string($file)) {
|
||||
$this->info("Importing CSV file {$file} to user {$user->id}");
|
||||
}
|
||||
|
||||
// create special gender for this import
|
||||
// we don't know which gender all the contacts are, so we need to create a special status for them, as we
|
||||
// can't guess whether they are men, women or else.
|
||||
$gender = Gender::where('name', config('dav.default_gender'))->first();
|
||||
if (! $gender) {
|
||||
$gender = new Gender;
|
||||
$gender->account_id = $user->account_id;
|
||||
$gender->name = config('dav.default_gender');
|
||||
$gender->save();
|
||||
}
|
||||
|
||||
$first = true;
|
||||
$imported = 0;
|
||||
$handle = fopen($file, 'r');
|
||||
try {
|
||||
while (($data = fgetcsv($handle)) !== false) { /** @phpstan-ignore-line */
|
||||
// don't import the columns
|
||||
if ($first) {
|
||||
$first = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if first & last name do not exist skip row
|
||||
if (empty($data[1]) && empty($data[3])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->csvToContact($data, $user->account_id, $gender->id);
|
||||
|
||||
$imported++;
|
||||
}
|
||||
} finally {
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
$this->info("Imported {$imported} Contacts");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create contact.
|
||||
*/
|
||||
private function csvToContact($data, $account_id, $gender_id)
|
||||
{
|
||||
$contact = new Contact();
|
||||
$contact->account_id = $account_id;
|
||||
$contact->gender_id = $gender_id;
|
||||
|
||||
if (! empty($data[1])) {
|
||||
$contact->first_name = $data[1]; // Given Name
|
||||
}
|
||||
|
||||
if (! empty($data[2])) {
|
||||
$contact->middle_name = $data[2]; // Additional Name
|
||||
}
|
||||
|
||||
if (! empty($data[3])) {
|
||||
$contact->last_name = $data[3]; // Family Name
|
||||
}
|
||||
|
||||
$street = null;
|
||||
if (! empty($data[49])) {
|
||||
$street = $data[49]; // address 1 street
|
||||
}
|
||||
|
||||
$city = null;
|
||||
if (! empty($data[50])) {
|
||||
$city = $data[50]; // address 1 city
|
||||
}
|
||||
|
||||
$province = null;
|
||||
if (! empty($data[52])) {
|
||||
$province = $data[52]; // address 1 region (state)
|
||||
}
|
||||
|
||||
$postalCode = null;
|
||||
if (! empty($data[53])) {
|
||||
$postalCode = $data[53]; // address 1 postal code (zip) 53
|
||||
}
|
||||
|
||||
if (! empty($data[66])) {
|
||||
$contact->job = $data[66]; // organization 1 name 66
|
||||
}
|
||||
|
||||
$contact->setAvatarColor();
|
||||
$contact->save();
|
||||
|
||||
if (! empty($data[28])) {
|
||||
// Email 1 Value
|
||||
ContactField::firstOrCreate([
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'data' => $data[28],
|
||||
'contact_field_type_id' => $this->contactFieldEmailId(),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($postalCode || $province || $street || $city) {
|
||||
$request = [
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'street' => $street,
|
||||
'city' => $city,
|
||||
'province' => $province,
|
||||
'postal_code' => $postalCode,
|
||||
];
|
||||
|
||||
app(CreateAddress::class)->execute($request);
|
||||
}
|
||||
|
||||
if (! empty($data[42])) {
|
||||
// Phone 1 Value
|
||||
ContactField::firstOrCreate([
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'data' => $data[42],
|
||||
'contact_field_type_id' => $this->contactFieldPhoneId(),
|
||||
]);
|
||||
}
|
||||
|
||||
if (! empty($data[14])) {
|
||||
$birthdate = DateHelper::parseDate($data[14]);
|
||||
|
||||
$specialDate = $contact->setSpecialDate('birthdate', $birthdate->year, $birthdate->month, $birthdate->day);
|
||||
|
||||
app(CreateReminder::class)->execute([
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'initial_date' => DateHelper::getDate($specialDate),
|
||||
'frequency_type' => 'year',
|
||||
'frequency_number' => 1,
|
||||
'title' => trans(
|
||||
'people.people_add_birthday_reminder',
|
||||
['name' => $contact->first_name]
|
||||
),
|
||||
'delible' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
GetAvatarsFromInternet::dispatch($contact);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default contact field email id for the account.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function contactFieldEmailId()
|
||||
{
|
||||
if (! $this->contactFieldEmailId) {
|
||||
$contactFieldType = ContactFieldType::where('type', 'email')->first();
|
||||
$this->contactFieldEmailId = $contactFieldType->id;
|
||||
}
|
||||
|
||||
return $this->contactFieldEmailId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default contact field phone id for the account.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function contactFieldPhoneId()
|
||||
{
|
||||
if (! $this->contactFieldPhoneId) {
|
||||
$contactFieldType = ContactFieldType::where('type', 'phone')->first();
|
||||
$this->contactFieldPhoneId = $contactFieldType->id;
|
||||
}
|
||||
|
||||
return $this->contactFieldPhoneId;
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Http\File;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\AddContactFromVCard;
|
||||
use App\Models\Account\ImportJob;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ImportVCards extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'import:vcard
|
||||
{--user= : user to import the contacts}
|
||||
{--path= : path of the file to import}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Imports contacts from vCard files for a specific user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @param Filesystem $filesystem
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Filesystem $filesystem)
|
||||
{
|
||||
$email = $this->option('user');
|
||||
|
||||
// if no email was passed to the option, prompt the user to enter the email
|
||||
if (! $email) {
|
||||
$email = $this->ask('what is the user\'s email?');
|
||||
}
|
||||
|
||||
// retrieve the user with the specified email
|
||||
$user = User::where('email', $email)->first();
|
||||
|
||||
if (! $user) {
|
||||
// show an error and exist if the user does not exist
|
||||
$this->error('No user with that email.');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$path = $this->option('path');
|
||||
|
||||
// if no email was passed to the option, prompt the user to enter the email
|
||||
if (! $path) {
|
||||
$path = $this->ask('what file you want to import?');
|
||||
}
|
||||
|
||||
if (! $filesystem->exists($path) || ! $this->acceptedExtensions($filesystem, $path)) {
|
||||
$this->error('The provided vcard file was not found or is not valid!');
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
$importJob = $this->import($path, $user);
|
||||
|
||||
return $this->report($importJob) ? 0 : 1;
|
||||
}
|
||||
|
||||
private function acceptedExtensions(Filesystem $filesystem, string $path): bool
|
||||
{
|
||||
switch ($filesystem->extension($path)) {
|
||||
case 'vcf':
|
||||
case 'vcard':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private function import(string $path, User $user): ImportJob
|
||||
{
|
||||
$pathName = Storage::putFile('public', new File($path));
|
||||
|
||||
$importJob = $user->account->importjobs()->create([
|
||||
'user_id' => $user->id,
|
||||
'type' => 'vcard',
|
||||
'filename' => $pathName,
|
||||
]);
|
||||
|
||||
AddContactFromVCard::dispatchSync($importJob);
|
||||
|
||||
return $importJob;
|
||||
}
|
||||
|
||||
private function report(ImportJob $importJob)
|
||||
{
|
||||
$importJob->refresh();
|
||||
|
||||
if ($importJob->failed) {
|
||||
$this->warn('Error: '.$importJob->failed_reason);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->info('Contacts found: '.$importJob->contacts_found);
|
||||
$this->info('Contacts skipped: '.$importJob->contacts_skipped);
|
||||
$this->info('Contacts imported: '.$importJob->contacts_imported);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
class Inspire extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'inspire';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class LangGenerate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'lang:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate i18n json assets';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$dirs = new DirectoryIterator(resource_path('lang').'/');
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if (! $dir->isDir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lang = $dir->getFilename();
|
||||
if ($lang == '.' || $lang == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->call('lang:js', [
|
||||
'--json' => true,
|
||||
'--source' => $dir->getPathname(),
|
||||
'target' => 'public/js/langs/'.$lang.'.json',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Helpers\DBHelper;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
|
||||
class MigrateDatabaseCollation extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'migrate:collation
|
||||
{--force : Force the operation to run when in production.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update database for utf8mb4 collation';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->confirmToProceed()) {
|
||||
try {
|
||||
$connection = DBHelper::connection();
|
||||
|
||||
if ($connection->getDriverName() != 'mysql') {
|
||||
return;
|
||||
}
|
||||
|
||||
$databasename = $connection->getDatabaseName();
|
||||
|
||||
$schemata = $connection->table('information_schema.schemata')
|
||||
->select('DEFAULT_CHARACTER_SET_NAME')
|
||||
->where('schema_name', '=', $databasename)
|
||||
->get();
|
||||
|
||||
$schema = $schemata->first()->DEFAULT_CHARACTER_SET_NAME;
|
||||
|
||||
if (config('database.use_utf8mb4') && $schema == 'utf8') {
|
||||
$this->line('Migrate to utf8mb4 schema collation');
|
||||
$this->toUtf8mb4($connection, $databasename);
|
||||
} elseif (! config('database.use_utf8mb4') && $schema == 'utf8mb4') {
|
||||
$this->line('Migrate to utf8 schema collation');
|
||||
$this->toUtf8($connection, $databasename);
|
||||
} else {
|
||||
$this->info('Nothing to migrate, everything is ok.');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error(' ');
|
||||
$this->error(' Check if the DB_USE_UTF8MB4 variable in .env file is correctly set ');
|
||||
$this->error(' ');
|
||||
$this->info('');
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to utf8mb4.
|
||||
*
|
||||
* @param \Illuminate\Database\Connection $connection
|
||||
* @param string $databasename
|
||||
*/
|
||||
private function toUtf8mb4($connection, $databasename)
|
||||
{
|
||||
// Tables
|
||||
$tables = $connection->table('information_schema.tables')
|
||||
->select('table_name')
|
||||
->where('table_schema', '=', $databasename)
|
||||
->get();
|
||||
|
||||
foreach ($tables as $table) {
|
||||
DB::statement('ALTER TABLE `'.$table->table_name.'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
||||
}
|
||||
|
||||
// Database
|
||||
$pdo = $connection->getPdo();
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
|
||||
DB::statement('ALTER DATABASE `'.$databasename.'` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;');
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to utf8.
|
||||
*
|
||||
* @param \Illuminate\Database\Connection $connection
|
||||
* @param string $databasename
|
||||
*/
|
||||
private function toUtf8($connection, $databasename)
|
||||
{
|
||||
// Tables
|
||||
$tables = $connection->table('information_schema.tables')
|
||||
->select('table_name')
|
||||
->where('table_schema', '=', $databasename)
|
||||
->get();
|
||||
|
||||
foreach ($tables as $table) {
|
||||
DB::statement('ALTER TABLE `'.$table->table_name.'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
|
||||
}
|
||||
|
||||
// Database
|
||||
$pdo = $connection->getPdo();
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
|
||||
DB::statement('ALTER DATABASE `'.$databasename.'` CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;');
|
||||
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\SynchronizeAddressBooks;
|
||||
use App\Services\DavClient\CreateAddressBookSubscription;
|
||||
|
||||
class NewAddressBookSubscription extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:newaddressbooksubscription
|
||||
{--email= : Monica account to add subscription to}
|
||||
{--url= : CardDAV url of the address book}
|
||||
{--login= : Login}
|
||||
{--password= : Password of the account}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Add a new all dav subscriptions';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$user = User::where('email', $this->option('email'))->firstOrFail();
|
||||
|
||||
$url = $this->option('url') ?? $this->ask('url', 'CardDAV url of the address book');
|
||||
$login = $this->option('login') ?? $this->ask('login', 'Login name');
|
||||
$password = $this->option('password') ?? $this->ask('password', 'User password');
|
||||
|
||||
try {
|
||||
$addressBookSubscription = app(CreateAddressBookSubscription::class)->execute([
|
||||
'account_id' => $user->account_id,
|
||||
'user_id' => $user->id,
|
||||
'base_uri' => $url,
|
||||
'username' => $login,
|
||||
'password' => $password,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
if (! isset($addressBookSubscription)) {
|
||||
$this->error('Could not add subscription');
|
||||
} else {
|
||||
$this->info('Subscription added');
|
||||
SynchronizeAddressBooks::dispatch($addressBookSubscription, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\OneTime;
|
||||
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
|
||||
class MoveAvatars extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:moveavatars
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--dryrun : Simulate the execution but not write anything.}
|
||||
{--storage= : new storage to move avatars to}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Move avatars from their current storage to current default storage';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Contact::where('has_avatar', true)
|
||||
->chunk(200, function ($contacts) {
|
||||
$this->handleContacts($contacts);
|
||||
});
|
||||
}
|
||||
|
||||
private function handleContacts($contacts)
|
||||
{
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact->avatar_location == $this->newStorage()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->handleOneContact($contact);
|
||||
} catch (FileNotFoundException $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function handleOneContact($contact)
|
||||
{
|
||||
// move avatars to new location
|
||||
$this->moveContactAvatars($contact);
|
||||
|
||||
if (! $this->option('dryrun')) {
|
||||
$contact->deleteAvatars();
|
||||
$this->line(' Files deleted from old location.', null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
// Update location. The filename has not changed.
|
||||
$contact->avatar_location = $this->newStorage();
|
||||
$contact->save();
|
||||
}
|
||||
}
|
||||
|
||||
private function moveContactAvatars($contact)
|
||||
{
|
||||
$this->line('Contact id:'.$contact->id.' | Avatar location:'.$contact->avatar_location.' | File name:'.$contact->avatar_file_name);
|
||||
|
||||
$avatarFileNames = [];
|
||||
array_push($avatarFileNames, $this->getFileName($contact));
|
||||
array_push($avatarFileNames, $this->getFileName($contact, 110));
|
||||
array_push($avatarFileNames, $this->getFileName($contact, 174));
|
||||
|
||||
$storage = Storage::disk($contact->avatar_location);
|
||||
$newStorage = Storage::disk($this->newStorage());
|
||||
|
||||
foreach ($avatarFileNames as $avatarFileName) {
|
||||
if ($newStorage->exists($avatarFileName)) {
|
||||
$this->line(' File already pushed: '.$avatarFileName, null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
continue;
|
||||
}
|
||||
if (! $this->option('dryrun')) {
|
||||
$avatarFile = $storage->get($avatarFileName);
|
||||
$newStorage->put($avatarFileName, $avatarFile, config('filesystems.default_visibility'));
|
||||
}
|
||||
|
||||
$this->line(' File pushed: '.$avatarFileName, null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
private function getFileName($contact, $size = null)
|
||||
{
|
||||
$filename = pathinfo($contact->avatar_file_name, PATHINFO_FILENAME);
|
||||
$extension = pathinfo($contact->avatar_file_name, PATHINFO_EXTENSION);
|
||||
|
||||
$avatarFileName = 'avatars/'.$filename.'.'.$extension;
|
||||
if (! is_null($size)) {
|
||||
$avatarFileName = 'avatars/'.$filename.'_'.$size.'.'.$extension;
|
||||
}
|
||||
|
||||
if ($this->fileExists($contact->avatar_location, $avatarFileName)) {
|
||||
return $avatarFileName;
|
||||
}
|
||||
}
|
||||
|
||||
private function fileExists($storage, $avatarFileName): bool
|
||||
{
|
||||
$storage = Storage::disk($storage);
|
||||
|
||||
if (! $storage->exists($avatarFileName)) {
|
||||
$this->line(' ! File not found: '.$avatarFileName, null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function newStorage()
|
||||
{
|
||||
return $this->option('storage') ?? config('filesystems.default');
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\OneTime;
|
||||
|
||||
use App\Events\MoveAvatarEvent;
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use App\Exceptions\FileNotFoundException;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use App\Jobs\Avatars\MoveContactAvatarToPhotosDirectory;
|
||||
|
||||
/**
|
||||
* This command moves current avatars to the new Photos directory and converts
|
||||
* each avatar to a Photo object.
|
||||
*/
|
||||
class MoveAvatarsToPhotosDirectory extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:moveavatarstophotosdirectory
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--dryrun : Simulate the execution but not write anything.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Move avatars to the Photos directory, and create a photo object for each one of them';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Event::listen(MoveAvatarEvent::class, function ($event) {
|
||||
$this->handleEvent($event->contact);
|
||||
});
|
||||
|
||||
$delay = now();
|
||||
|
||||
Contact::where('has_avatar', true)
|
||||
->chunk(100, function ($contacts) use ($delay) {
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact->avatar_source === 'default') {
|
||||
$this->handleContact($contact, $delay);
|
||||
}
|
||||
}
|
||||
// add some delay, so we treat 100 contacts each minutes
|
||||
$delay = $delay->addMinutes(1);
|
||||
});
|
||||
}
|
||||
|
||||
private function handleContact($contact, $delay)
|
||||
{
|
||||
try {
|
||||
if ($this->option('dryrun')) {
|
||||
MoveContactAvatarToPhotosDirectory::dispatchNow($contact, true);
|
||||
} else {
|
||||
MoveContactAvatarToPhotosDirectory::dispatch($contact, false)
|
||||
->delay($delay);
|
||||
}
|
||||
} catch (FileNotFoundException $e) {
|
||||
$this->warn(' ! File not found: '.$e->fileName, OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleEvent($contact)
|
||||
{
|
||||
$this->info('Contact id:'.$contact->id.' | Avatar location:'.$contact->avatar_location.' | File name:'.$contact->avatar_file_name);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Laravel\Passport\PersonalAccessClient;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Passport extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:passport {--force : Force the operation to run when in production.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check if encryption keys and Personal Access Client are present, and create them if not.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->confirmToProceed()) {
|
||||
$this->checkEncryptionKeys();
|
||||
$this->checkPersonalAccessClient();
|
||||
}
|
||||
}
|
||||
|
||||
private function checkEncryptionKeys()
|
||||
{
|
||||
$this->info('Checking encryption keys...', OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
if (! empty(config('passport.private_key')) && ! empty(config('passport.public_key'))) {
|
||||
$this->info('✓ PASSPORT_PRIVATE_KEY and PASSPORT_PUBLIC_KEY detected.', OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists(base_path('storage/oauth-private.key')) && file_exists(base_path('storage/oauth-public.key'))) {
|
||||
$this->info('✓ Files storage/oauth-private.key and storage/oauth-public.key detected.', OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->artisan('✓ Creating encryption keys', 'passport:keys', ['--no-interaction']);
|
||||
$this->warn('! Please be careful to backup '.base_path('storage/oauth-public.key').' and '.base_path('storage/oauth-private.key').' files !', OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
|
||||
private function checkPersonalAccessClient()
|
||||
{
|
||||
$this->info('Checking Personal Access Client...', OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
if (PersonalAccessClient::count() > 0) {
|
||||
$this->info('✓ Personal Access Client already created.', OutputInterface::VERBOSITY_VERBOSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->artisan('✓ Creating personal access client', 'passport:client', ['--personal', '--no-interaction']);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use PharIo\Version\Version;
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Instance\Instance;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class PingVersionServer extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:ping
|
||||
{--force : Force the operation to run when in production.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Ping version.monicahq.com to know if a new version is available';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! config('monica.check_version')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->confirmToProceed('Checking version deactivated', function () {
|
||||
return $this->getLaravel()->environment() === 'production';
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$instance = Instance::first();
|
||||
$instance->current_version = config('monica.app_version');
|
||||
|
||||
if ($instance->current_version == '') {
|
||||
Log::warning('Current instance version is not set, skipping version check.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Query version.monicahq.com
|
||||
try {
|
||||
$this->log('Call url: '.config('monica.weekly_ping_server_url'));
|
||||
$response = Http::acceptJson()
|
||||
->post(config('monica.weekly_ping_server_url'), [
|
||||
'uuid' => $instance->uuid,
|
||||
'version' => $instance->current_version,
|
||||
'contacts' => Contact::count(),
|
||||
])
|
||||
->throw();
|
||||
} catch (RequestException $e) {
|
||||
$this->error('Error calling "'.config('monica.weekly_ping_server_url').'": '.$e->getMessage());
|
||||
Log::error(__CLASS__.' Error calling "'.config('monica.weekly_ping_server_url').'": '.$e->getMessage(), [$e]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Receive the JSON
|
||||
$json = $response->json();
|
||||
|
||||
$this->log('instance version: '.$instance->current_version);
|
||||
$currentVersion = $this->getVersion($instance->current_version);
|
||||
|
||||
$this->log('current version: '.$json['latest_version']);
|
||||
$latestVersion = $this->getVersion($json['latest_version']);
|
||||
|
||||
if ($latestVersion > $currentVersion) {
|
||||
$instance->latest_version = $json['latest_version'];
|
||||
$instance->latest_release_notes = $json['notes'];
|
||||
$instance->number_of_versions_since_current_version = $json['number_of_versions_since_user_version'];
|
||||
} else {
|
||||
$instance->latest_release_notes = null;
|
||||
$instance->number_of_versions_since_current_version = null;
|
||||
}
|
||||
|
||||
$instance->save();
|
||||
}
|
||||
|
||||
public function log($string)
|
||||
{
|
||||
$this->info($string, OutputInterface::VERBOSITY_VERBOSE);
|
||||
}
|
||||
|
||||
private function getVersion(string $version): ?Version
|
||||
{
|
||||
try {
|
||||
return new Version($version);
|
||||
} catch (\Exception $e) {
|
||||
$this->error("Error parsing version '$version': ".$e->getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Contact\ReminderOutbox;
|
||||
use App\Jobs\Reminder\NotifyUserAboutReminder;
|
||||
|
||||
class SendReminders extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:reminders';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Send reminders that are scheduled for the contacts';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
// Grab all the reminders that are supposed to be sent in the next two days
|
||||
// Why 2? because in terms of timezone, we can have up to more than 24 hours
|
||||
// between two timezones and we need to take into accounts reminders
|
||||
// that are not in the same timezone.
|
||||
ReminderOutbox::where('planned_date', '<', now()->addDays(2))
|
||||
->orderBy('planned_date', 'asc')
|
||||
->chunk(500, function ($reminderOutboxes) {
|
||||
$this->send($reminderOutboxes);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the reminder to the user and schedule the future.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function send($reminderOutboxes)
|
||||
{
|
||||
foreach ($reminderOutboxes as $reminderOutbox) {
|
||||
if ($reminderOutbox->user->isTheRightTimeToBeReminded($reminderOutbox->planned_date)) {
|
||||
NotifyUserAboutReminder::dispatch($reminderOutbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\StayInTouch\ScheduleStayInTouch;
|
||||
|
||||
class SendStayInTouch extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'send:stay_in_touch';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Send notifications about staying in touch with contacts';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
// we add two days to make sure we cover all timezones
|
||||
Contact::where('stay_in_touch_trigger_date', '<', now()->addDays(2))
|
||||
->whereNotNull('stay_in_touch_frequency')
|
||||
->orderBy('stay_in_touch_trigger_date', 'asc')
|
||||
->chunk(500, function ($contacts) {
|
||||
$this->schedule($contacts);
|
||||
});
|
||||
}
|
||||
|
||||
private function schedule($contacts)
|
||||
{
|
||||
foreach ($contacts as $contact) {
|
||||
ScheduleStayInTouch::dispatch($contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendTestEmail extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:test-email
|
||||
{--email= : The email address to send to}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Send a test email to check that delivery is working';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
/** retrieve the email from the option.
|
||||
* @var string $email
|
||||
*/
|
||||
$email = $this->option('email');
|
||||
|
||||
// if no email was passed to the option, prompt the user to enter the email
|
||||
if (! $email) {
|
||||
$email = (string) $this->ask('What email address should I send the test email to?');
|
||||
}
|
||||
|
||||
// Validate user provided email address
|
||||
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
|
||||
$this->error("Invalid email address: \"$email\".");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->info("Preparing and sending email to \"$email\"");
|
||||
|
||||
// immediately deliver the test email (bypassing the queue)
|
||||
Mail::raw(
|
||||
"Hi $email, you requested a test email from Monica.",
|
||||
function ($message) use ($email) {
|
||||
$message->to($email)
|
||||
->subject('Monica email delivery test');
|
||||
}
|
||||
);
|
||||
|
||||
$this->info('Email sent!');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use function Safe\exec;
|
||||
use function Safe\mkdir;
|
||||
use Illuminate\Console\Command;
|
||||
use function Safe\file_put_contents;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SentryRelease extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'sentry:release
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--release= : release version for sentry.}
|
||||
{--store-release : store release version in config/.release file.}
|
||||
{--commit= : commit associated with this release.}
|
||||
{--environment= : sentry environment.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a release for sentry';
|
||||
|
||||
/**
|
||||
* Installation path of sentry cli.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $install_dir;
|
||||
|
||||
/**
|
||||
* sentry cli name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private const SENTRY_CLI = 'sentry-cli';
|
||||
|
||||
/**
|
||||
* Sentry cli download url.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private const SENTRY_URL = 'https://sentry.io/get-cli/';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! config('monica.sentry_support') || ! $this->check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->confirmToProceed()) {
|
||||
$this->install_dir = env('SENTRY_ROOT', getenv('HOME').'/.local/bin');
|
||||
|
||||
$release = $this->option('release') ?? config('sentry.release');
|
||||
$commit = $this->option('commit') ??
|
||||
(is_dir(__DIR__.'/../../../.git') ? trim(exec('git log --pretty="%H" -n1 HEAD')) : $release);
|
||||
|
||||
// Sentry update
|
||||
$this->exec('Update sentry', $this->getSentryCli().' update');
|
||||
|
||||
// Create a release
|
||||
$this->execSentryCli('Create a release', 'releases new '.$release.' --finalize --project '.config('sentry-release.project'));
|
||||
|
||||
// Associate commits with the release
|
||||
$this->execSentryCli('Associate commits with the release', 'releases set-commits '.$release.' --commit "'.config('sentry-release.repo').'@'.$commit.'"');
|
||||
|
||||
// Create a deploy
|
||||
$this->execSentryCli('Create a deploy', 'releases deploys '.$release.' new --env '.$this->option('environment').' --name '.config('monica.app_version'));
|
||||
|
||||
if ($this->option('store-release')) {
|
||||
// Set sentry release
|
||||
$this->line('Store release in config/.release file', null, OutputInterface::VERBOSITY_VERBOSE);
|
||||
file_put_contents(__DIR__.'/../../../config/.release', $release);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function check(): bool
|
||||
{
|
||||
$check = true;
|
||||
if (empty(config('sentry-release.auth_token'))) {
|
||||
$this->error('You must provide an auth_token (SENTRY_AUTH_TOKEN)');
|
||||
$check = false;
|
||||
}
|
||||
if (empty(config('sentry-release.organisation'))) {
|
||||
$this->error('You must provide an organisation slug (SENTRY_ORG)');
|
||||
$check = false;
|
||||
}
|
||||
if (empty(config('sentry-release.project'))) {
|
||||
$this->error('You must set the project (SENTRY_PROJECT)');
|
||||
$check = false;
|
||||
}
|
||||
if (empty(config('sentry-release.repo'))) {
|
||||
$this->error('You must set the repository (SENTRY_REPO)');
|
||||
$check = false;
|
||||
}
|
||||
if (empty($this->option('environment'))) {
|
||||
$this->error('No environment given');
|
||||
$check = false;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
private function getSentryCli()
|
||||
{
|
||||
if (! file_exists($this->install_dir.'/'.self::SENTRY_CLI)) {
|
||||
mkdir($this->install_dir, 0777, true);
|
||||
$this->exec('Downloading sentry-cli', 'curl -sL '.self::SENTRY_URL.' | INSTALL_DIR='.$this->install_dir.' bash');
|
||||
}
|
||||
|
||||
return $this->install_dir.'/'.self::SENTRY_CLI;
|
||||
}
|
||||
|
||||
private function execSentryCli($message, $command)
|
||||
{
|
||||
$this->exec($message, $this->getSentryCli().' '.$command);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Account\Account;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SetPremiumAccount extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'account:setpremium {accountId}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Give a premium access to an account.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$account = Account::findOrFail($this->argument('accountId'));
|
||||
$account->update([
|
||||
'has_access_to_paid_version_for_free' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SetUserAdmin extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:admin
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--email= : The email of the user whose admin status you want to change}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Toggle administrator privileges for a user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// retrieve the email from the option
|
||||
$email = $this->option('email');
|
||||
|
||||
// if no email was passed to the option, prompt the user to enter the email
|
||||
if (! $email) {
|
||||
$email = $this->ask('What is the user’s email?');
|
||||
}
|
||||
|
||||
// retrieve the user with the specified email
|
||||
$user = User::where('email', $email)->first();
|
||||
|
||||
if (! $user) {
|
||||
// show an error and exist if the user does not exist
|
||||
$this->error('No user with that email.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Print a warning
|
||||
if ($user->admin) {
|
||||
$this->warn($user->email.' will be removed from the administrators of this instance');
|
||||
} else {
|
||||
$this->warn($user->email.' will be added to the administrators of this instance');
|
||||
}
|
||||
|
||||
// ask for confirmation if not forced
|
||||
if (! $this->option('force') && ! $this->confirm('Do you wish to continue?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// toglle admin status
|
||||
$user->admin = ! $user->admin;
|
||||
$user->save();
|
||||
|
||||
// Show new status
|
||||
if ($user->admin) {
|
||||
$this->info($user->email.' has been added to the administrators of this instance');
|
||||
} else {
|
||||
$this->info($user->email.' has been removed from the administrators of this instance');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use function Safe\touch;
|
||||
use App\Helpers\InstanceHelper;
|
||||
use App\Models\Account\Account;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SetupProduction extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'setup:production
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--email= : Login email for the first account.}
|
||||
{--password= : Password to set for the first account.}
|
||||
{--skipSeed : Skip the populate database process.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Perform setup of Monica.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ((! $this->option('force')) && (! $this->confirm('You are about to setup and configure Monica. Do you wish to continue?'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the .env file does not exist, then key generation
|
||||
* will fail. So we create one if it does not already exist.
|
||||
*/
|
||||
if (! file_exists(__DIR__.'/../../../.env')) {
|
||||
touch(__DIR__.'/../../../.env');
|
||||
}
|
||||
|
||||
$this->call('monica:update', ['--force' => true]);
|
||||
|
||||
if (! $this->option('skipSeed')) {
|
||||
$this->line('✓ Filling database');
|
||||
$this->call('db:seed', ['--force' => true]);
|
||||
}
|
||||
|
||||
$this->line('');
|
||||
$this->line('-----------------------------');
|
||||
$this->line('|');
|
||||
$this->line('| Welcome to Monica v'.config('monica.app_version'));
|
||||
$this->line('|');
|
||||
$this->line('-----------------------------');
|
||||
|
||||
$email = $this->option('email');
|
||||
$password = $this->option('password');
|
||||
if (! empty($email) && ! empty($password)) {
|
||||
Account::createDefault('John', 'Doe', $email, $password);
|
||||
|
||||
$this->info('| You can now sign in to your account:');
|
||||
$this->line('| username: '.$email);
|
||||
$this->line('| password: <hidden>');
|
||||
} elseif (InstanceHelper::hasAtLeastOneAccount()) {
|
||||
$this->info('| You can now log in to your account');
|
||||
} else {
|
||||
$this->info('| You can now register to the first account by opening the application:');
|
||||
}
|
||||
|
||||
$this->line('| URL: '.config('app.url'));
|
||||
$this->line('-----------------------------');
|
||||
|
||||
$this->info('Setup is done. Have fun.');
|
||||
}
|
||||
}
|
||||
@@ -1,677 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use function Safe\exec;
|
||||
use App\Models\User\User;
|
||||
use App\Helpers\DateHelper;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Helpers\CountriesHelper;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Console\Application;
|
||||
use App\Models\Contact\LifeEventType;
|
||||
use App\Models\Contact\ContactFieldType;
|
||||
use App\Services\Contact\Gift\CreateGift;
|
||||
use App\Services\Contact\Tag\AssociateTag;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use App\Services\Contact\Address\CreateAddress;
|
||||
use App\Services\Contact\Contact\CreateContact;
|
||||
use App\Services\Contact\Reminder\CreateReminder;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use App\Services\Contact\LifeEvent\CreateLifeEvent;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use App\Services\Contact\Conversation\CreateConversation;
|
||||
use App\Services\Contact\Relationship\CreateRelationship;
|
||||
use App\Services\Account\Activity\Activity\CreateActivity;
|
||||
use App\Services\Contact\Contact\UpdateBirthdayInformation;
|
||||
use App\Services\Contact\Contact\UpdateDeceasedInformation;
|
||||
use App\Services\Contact\Conversation\AddMessageToConversation;
|
||||
use App\Services\Account\Activity\Activity\AttachContactToActivity;
|
||||
|
||||
class SetupTest extends Command
|
||||
{
|
||||
use WithFaker;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'setup:test
|
||||
{--skipSeed : Skip the populate database with fake data.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create the test environment with optional fake data for testing purposes.';
|
||||
|
||||
/**
|
||||
* The number of contacts that need to be generated.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $numberOfContacts;
|
||||
|
||||
/**
|
||||
* The Current contact instance.
|
||||
*
|
||||
* @var Contact
|
||||
*/
|
||||
private $contact;
|
||||
|
||||
/**
|
||||
* The current Contact instance.
|
||||
*
|
||||
* @var Account
|
||||
*/
|
||||
private $account;
|
||||
|
||||
/**
|
||||
* The list of countries.
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
private $countries = null;
|
||||
|
||||
/**
|
||||
* The logged user.
|
||||
*
|
||||
* @var User
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (! $this->confirm('Are you sure you want to proceed? This will delete ALL data in your environment.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->artisan('✓ Performing migrations', 'migrate:fresh');
|
||||
|
||||
$this->artisan('✓ Symlink the storage folder', 'storage:link');
|
||||
|
||||
if (! $this->option('skipSeed')) {
|
||||
$this->numberOfContacts = $this->ask('How many contacts would you like to have in this test account?');
|
||||
$this->info('✓ Filling database with fake data');
|
||||
$this->seed();
|
||||
}
|
||||
|
||||
$this->line('');
|
||||
$this->line('-----------------------------');
|
||||
$this->line('|');
|
||||
$this->line('| Welcome to Monica v'.config('monica.app_version'));
|
||||
$this->line('|');
|
||||
$this->line('-----------------------------');
|
||||
$this->info('| You can now sign in to your account:');
|
||||
$this->line('| username: admin@admin.com');
|
||||
$this->line('| password: admin0');
|
||||
$this->line('| URL: '.config('app.url'));
|
||||
$this->line('-----------------------------');
|
||||
|
||||
$this->info('Setup is done. Have fun.');
|
||||
}
|
||||
|
||||
public function exec($message, $command)
|
||||
{
|
||||
$this->info($message);
|
||||
$this->line($command);
|
||||
exec($command, $output);
|
||||
$this->line(implode('\n', $output));
|
||||
$this->line('');
|
||||
}
|
||||
|
||||
public function artisan($message, $command, array $arguments = [])
|
||||
{
|
||||
$this->info($message);
|
||||
$this->line(Application::formatCommandString($command));
|
||||
$this->callSilent($command, $arguments);
|
||||
$this->line('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function seed()
|
||||
{
|
||||
$this->setUpFaker();
|
||||
|
||||
// Get or create the first account
|
||||
if (User::where('email', 'admin@admin.com')->exists()) {
|
||||
$this->user = User::where('email', 'admin@admin.com')->first();
|
||||
$userId = $this->user->value('id');
|
||||
$this->account = Account::where('id', $userId)->first();
|
||||
} else {
|
||||
$this->account = Account::createDefault('John', 'Doe', 'admin@admin.com', 'admin0');
|
||||
|
||||
// set default admin account to confirmed
|
||||
/** @var User */
|
||||
$adminUser = $this->account->users()->first();
|
||||
$this->confirmUser($adminUser);
|
||||
$this->user = $adminUser;
|
||||
}
|
||||
|
||||
// create a random number of contacts
|
||||
//$this->numberOfContacts = rand(60, 100);
|
||||
echo 'Generating '.$this->numberOfContacts.' fake contacts'.PHP_EOL;
|
||||
|
||||
$output = new ConsoleOutput();
|
||||
$progress = new ProgressBar($output, $this->numberOfContacts);
|
||||
$progress->start();
|
||||
|
||||
for ($i = 0; $i < $this->numberOfContacts; $i++) {
|
||||
$gender = (rand(1, 2) == 1) ? 'male' : 'female';
|
||||
|
||||
$this->contact = app(CreateContact::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'author_id' => $this->user->id,
|
||||
'first_name' => $this->faker->firstName($gender),
|
||||
'last_name' => (rand(1, 2) == 1) ? $this->faker->lastName : null,
|
||||
'nickname' => (rand(1, 2) == 1) ? $this->faker->name : null,
|
||||
'gender_id' => $this->getRandomGender()->id,
|
||||
'is_partial' => false,
|
||||
'is_birthdate_known' => false,
|
||||
'is_deceased' => false,
|
||||
'is_deceased_date_known' => false,
|
||||
]);
|
||||
|
||||
$this->populateTags();
|
||||
$this->populateFoodPreferences();
|
||||
$this->populateDeceasedDate();
|
||||
$this->populateBirthday();
|
||||
$this->populateFirstMetInformation();
|
||||
$this->populateRelationships();
|
||||
$this->populateNotes();
|
||||
$this->populateActivities();
|
||||
$this->populateTasks();
|
||||
$this->populateDebts();
|
||||
$this->populateCalls();
|
||||
$this->populateConversations();
|
||||
$this->populateLifeEvents();
|
||||
$this->populateGifts();
|
||||
$this->populateAddresses();
|
||||
$this->populateContactFields();
|
||||
$this->populatePets();
|
||||
$this->changeUpdatedAt();
|
||||
|
||||
$progress->advance();
|
||||
}
|
||||
|
||||
$this->populateDayRatings();
|
||||
$this->populateEntries();
|
||||
|
||||
$progress->finish();
|
||||
|
||||
// create the second test, blank account
|
||||
if (! User::where('email', 'blank@blank.com')->exists()) {
|
||||
$blankAccount = Account::createDefault('Blank', 'State', 'blank@blank.com', 'blank0');
|
||||
$blankUser = $blankAccount->users()->first();
|
||||
$this->confirmUser($blankUser);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateTags()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
$i = 0;
|
||||
do {
|
||||
app(AssociateTag::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'name' => $this->faker->word,
|
||||
]);
|
||||
$i++;
|
||||
} while ($i < 10);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateFoodPreferences()
|
||||
{
|
||||
// add food preferences
|
||||
if (rand(1, 2) == 1) {
|
||||
$this->contact->food_preferences = $this->faker->realText();
|
||||
$this->contact->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function populateDeceasedDate()
|
||||
{
|
||||
// deceased?
|
||||
if (rand(1, 7) == 1) {
|
||||
$birthdate = $this->faker->dateTimeThisCentury();
|
||||
|
||||
app(UpdateDeceasedInformation::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'is_deceased' => rand(1, 2) == 1,
|
||||
'is_date_known' => rand(1, 2) == 1,
|
||||
'day' => (int) $birthdate->format('d'),
|
||||
'month' => (int) $birthdate->format('m'),
|
||||
'year' => (int) $birthdate->format('Y'),
|
||||
'add_reminder' => rand(1, 2) == 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateBirthday()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
$birthdate = $this->faker->dateTimeThisCentury();
|
||||
|
||||
app(UpdateBirthdayInformation::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'is_date_known' => rand(1, 2) == 1,
|
||||
'day' => (int) $birthdate->format('d'),
|
||||
'month' => (int) $birthdate->format('m'),
|
||||
'year' => (int) $birthdate->format('Y'),
|
||||
'is_age_based' => rand(1, 2) == 1,
|
||||
'age' => rand(1, 99),
|
||||
'add_reminder' => rand(1, 2) == 1,
|
||||
'is_deceased' => $this->contact->is_dead,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateFirstMetInformation()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
$this->contact->first_met_where = $this->faker->realText(20);
|
||||
}
|
||||
|
||||
if (rand(1, 2) == 1) {
|
||||
$this->contact->first_met_additional_info = $this->faker->realText(20);
|
||||
$firstMetDate = $this->faker->dateTimeThisCentury();
|
||||
|
||||
if (rand(1, 2) == 1) {
|
||||
// add a date where we don't know the year
|
||||
$specialDate = $this->contact->setSpecialDate('first_met', 0, intval($firstMetDate->format('m')), intval($firstMetDate->format('d')));
|
||||
} else {
|
||||
// add a date where we know the year
|
||||
$specialDate = $this->contact->setSpecialDate('first_met', intval($firstMetDate->format('Y')), intval($firstMetDate->format('m')), intval($firstMetDate->format('d')));
|
||||
}
|
||||
app(CreateReminder::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'initial_date' => $specialDate->date->toDateString(),
|
||||
'frequency_type' => 'year',
|
||||
'frequency_number' => 1,
|
||||
'title' => trans(
|
||||
'people.introductions_reminder_title',
|
||||
['name' => $this->contact->first_name]
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
if (rand(1, 2) == 1) {
|
||||
do {
|
||||
$rand = rand(1, $this->numberOfContacts);
|
||||
} while (in_array($rand, [$this->contact->id]));
|
||||
|
||||
$this->contact->first_met_through_contact_id = $rand;
|
||||
}
|
||||
|
||||
$this->contact->save();
|
||||
}
|
||||
|
||||
public function populateRelationships()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
foreach (range(1, rand(2, 6)) as $index) {
|
||||
$gender = (rand(1, 2) == 1) ? 'male' : 'female';
|
||||
|
||||
$relatedContact = app(CreateContact::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'author_id' => $this->user->id,
|
||||
'first_name' => $this->faker->firstName($gender),
|
||||
'last_name' => (rand(1, 2) == 1) ? $this->faker->lastName : null,
|
||||
'nickname' => (rand(1, 2) == 1) ? $this->faker->name : null,
|
||||
'gender_id' => $this->getRandomGender()->id,
|
||||
'is_partial' => rand(1, 2) == 1,
|
||||
'is_birthdate_known' => false,
|
||||
'is_deceased' => false,
|
||||
'is_deceased_date_known' => false,
|
||||
]);
|
||||
|
||||
$relatedContactBirthDate = $this->faker->dateTimeThisCentury();
|
||||
app(UpdateBirthdayInformation::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $relatedContact->id,
|
||||
'is_date_known' => rand(1, 2) == 1,
|
||||
'day' => (int) $relatedContactBirthDate->format('d'),
|
||||
'month' => (int) $relatedContactBirthDate->format('m'),
|
||||
'year' => (int) $relatedContactBirthDate->format('Y'),
|
||||
'is_age_based' => rand(1, 2) == 1,
|
||||
'age' => rand(1, 99),
|
||||
'add_reminder' => rand(1, 2) == 1,
|
||||
'is_deceased' => $relatedContact->is_dead,
|
||||
]);
|
||||
|
||||
// set relationship
|
||||
$relationshipId = $this->contact->account->relationshipTypes->random()->id;
|
||||
$relationship = app(CreateRelationship::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_is' => $this->contact->id,
|
||||
'of_contact' => $relatedContact->id,
|
||||
'relationship_type_id' => $relationshipId,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateNotes()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
for ($j = 0; $j < rand(1, 13); $j++) {
|
||||
$note = $this->contact->notes()->create([
|
||||
'body' => $this->faker->realText(rand(40, 500)),
|
||||
'account_id' => $this->account->id,
|
||||
'is_favorited' => rand(1, 3) == 1,
|
||||
'favorited_at' => $this->faker->dateTimeThisCentury(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateActivities()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
for ($j = 0; $j < rand(1, 13); $j++) {
|
||||
$date = DateHelper::getDate(Carbon::instance($this->faker->dateTimeThisYear($max = 'now')));
|
||||
|
||||
$request = [
|
||||
'account_id' => $this->account->id,
|
||||
'activity_type_id' => rand(1, 13),
|
||||
'summary' => $this->faker->realText(rand(40, 100)),
|
||||
'description' => (rand(1, 2) == 1 ? $this->faker->realText(rand(100, 1000)) : null),
|
||||
'happened_at' => $date,
|
||||
'contacts' => [$this->contact->id],
|
||||
];
|
||||
|
||||
$activity = app(CreateActivity::class)->execute($request);
|
||||
|
||||
$request = [
|
||||
'account_id' => $this->account->id,
|
||||
'activity_id' => $activity->id,
|
||||
'contacts' => [$this->contact->id],
|
||||
];
|
||||
|
||||
app(AttachContactToActivity::class)->execute($request);
|
||||
|
||||
DB::table('journal_entries')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'date' => $date,
|
||||
'journalable_id' => $activity->id,
|
||||
'journalable_type' => 'App\Models\Account\Activity',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateTasks()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
for ($j = 0; $j < rand(1, 10); $j++) {
|
||||
$task = $this->contact->tasks()->create([
|
||||
'title' => $this->faker->realText(rand(40, 100)),
|
||||
'description' => $this->faker->realText(rand(100, 1000)),
|
||||
'completed' => (rand(1, 2) == 1 ? 0 : 1),
|
||||
'completed_at' => (rand(1, 2) == 1 ? $this->faker->dateTimeThisCentury() : null),
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateDebts()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
for ($j = 0; $j < rand(1, 6); $j++) {
|
||||
$this->contact->debts()->create([
|
||||
'in_debt' => (rand(1, 2) == 1 ? 'yes' : 'no'),
|
||||
'amount' => rand(321, 39391),
|
||||
'reason' => $this->faker->realText(rand(100, 1000)),
|
||||
'status' => 'inprogress',
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateGifts()
|
||||
{
|
||||
if (rand(1, 2) == 1) {
|
||||
for ($j = 0; $j < rand(1, 31); $j++) {
|
||||
app(CreateGift::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'status' => (rand(1, 3) == 1 ? 'offered' : 'idea'),
|
||||
'name' => $this->faker->realText(rand(10, 100)),
|
||||
'comment' => $this->faker->realText(rand(1000, 5000)),
|
||||
'url' => $this->faker->url,
|
||||
'amount' => rand(12, 120),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateAddresses()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
$request = [
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'country' => $this->getRandomCountry(),
|
||||
'name' => $this->faker->word,
|
||||
'street' => (rand(1, 3) == 1) ? $this->faker->streetAddress : null,
|
||||
'city' => (rand(1, 3) == 1) ? $this->faker->city : null,
|
||||
'province' => (rand(1, 3) == 1) ? $this->faker->state : null,
|
||||
'postal_code' => (rand(1, 3) == 1) ? $this->faker->postcode : null,
|
||||
];
|
||||
|
||||
app(CreateAddress::class)->execute($request);
|
||||
}
|
||||
}
|
||||
|
||||
private function getRandomCountry()
|
||||
{
|
||||
if ($this->countries == null) {
|
||||
$this->countries = CountriesHelper::getAll();
|
||||
}
|
||||
|
||||
return $this->countries->random()['id'];
|
||||
}
|
||||
|
||||
public function populateContactFields()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
|
||||
// Fetch number of types
|
||||
$numberOfTypes = ContactFieldType::where('account_id', $this->account->id)->count();
|
||||
|
||||
for ($j = 0; $j < rand(1, $numberOfTypes); $j++) {
|
||||
// Retrieve random ContactFieldType
|
||||
$contactFieldType = ContactFieldType::where('account_id', $this->account->id)->orderBy(DB::raw('RAND()'))->firstOrFail();
|
||||
|
||||
// Fake data according to type
|
||||
$data = null;
|
||||
switch ($contactFieldType->name) {
|
||||
case 'Email':
|
||||
$data = $this->faker->email;
|
||||
break;
|
||||
case 'Phone':
|
||||
$data = $this->faker->phoneNumber;
|
||||
break;
|
||||
case 'Facebook':
|
||||
$data = 'https://facebook.com/'.$this->faker->userName;
|
||||
break;
|
||||
case 'Twitter':
|
||||
$data = 'https://twitter.com/'.$this->faker->userName;
|
||||
break;
|
||||
case 'Whatsapp':
|
||||
$data = $this->faker->phoneNumber;
|
||||
break;
|
||||
case 'Telegram':
|
||||
$data = $this->faker->phoneNumber;
|
||||
break;
|
||||
default:
|
||||
$data = $this->faker->url;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->contact->contactFields()->create([
|
||||
'contact_field_type_id' => $contactFieldType->id,
|
||||
'data' => $data,
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateEntries()
|
||||
{
|
||||
for ($j = 0; $j < rand(10, 100); $j++) {
|
||||
$date = $this->faker->dateTimeThisYear();
|
||||
|
||||
$entryId = DB::table('entries')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'title' => $this->faker->realText(rand(12, 20)),
|
||||
'post' => $this->faker->realText(rand(400, 500)),
|
||||
'created_at' => $date,
|
||||
]);
|
||||
|
||||
DB::table('journal_entries')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'date' => $date,
|
||||
'journalable_id' => $entryId,
|
||||
'journalable_type' => 'App\Models\Journal\Entry',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function populatePets()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
for ($j = 0; $j < rand(1, 3); $j++) {
|
||||
$date = $this->faker->dateTimeThisYear();
|
||||
|
||||
DB::table('pets')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'pet_category_id' => rand(1, 11),
|
||||
'name' => (rand(1, 3) == 1) ? $this->faker->firstName : null,
|
||||
'created_at' => $date,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateDayRatings()
|
||||
{
|
||||
for ($j = 0; $j < rand(10, 100); $j++) {
|
||||
$date = $this->faker->dateTimeThisYear();
|
||||
|
||||
$dayId = DB::table('days')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'rate' => rand(1, 3),
|
||||
'date' => $date,
|
||||
'created_at' => $date,
|
||||
]);
|
||||
|
||||
DB::table('journal_entries')->insertGetId([
|
||||
'account_id' => $this->account->id,
|
||||
'date' => $date,
|
||||
'journalable_id' => $dayId,
|
||||
'journalable_type' => 'App\Models\Journal\Day',
|
||||
'created_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function changeUpdatedAt()
|
||||
{
|
||||
$this->contact->last_consulted_at = Carbon::instance($this->faker->dateTimeThisYear());
|
||||
$this->contact->save();
|
||||
}
|
||||
|
||||
public function populateCalls()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
$this->contact->calls()->create([
|
||||
'account_id' => $this->account->id,
|
||||
'called_at' => $this->faker->dateTimeThisYear(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateConversations()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
for ($j = 0; $j < rand(1, 20); $j++) {
|
||||
$contactFieldType = ContactFieldType::where('account_id', $this->account->id)->orderBy(DB::raw('RAND()'))->firstOrFail();
|
||||
|
||||
$conversation = app(CreateConversation::class)->execute([
|
||||
'happened_at' => $this->faker->dateTimeThisCentury(),
|
||||
'contact_id' => $this->contact->id,
|
||||
'contact_field_type_id' => $contactFieldType->id,
|
||||
'account_id' => $this->account->id,
|
||||
]);
|
||||
|
||||
for ($k = 0; $k < rand(1, 20); $k++) {
|
||||
app(AddMessageToConversation::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'conversation_id' => $conversation->id,
|
||||
'written_at' => $this->faker->dateTimeThisCentury(),
|
||||
'written_by_me' => (rand(1, 2) == 1),
|
||||
'content' => $this->faker->realText(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function populateLifeEvents()
|
||||
{
|
||||
if (rand(1, 3) == 1) {
|
||||
for ($j = 0; $j < rand(1, 20); $j++) {
|
||||
$lifeEventType = LifeEventType::where('account_id', $this->account->id)->orderBy(DB::raw('RAND()'))->firstOrFail();
|
||||
|
||||
app(CreateLifeEvent::class)->execute([
|
||||
'account_id' => $this->account->id,
|
||||
'contact_id' => $this->contact->id,
|
||||
'life_event_type_id' => $lifeEventType->id,
|
||||
'happened_at' => $this->faker->dateTimeThisCentury(),
|
||||
'name' => $this->faker->realText(),
|
||||
'note' => $this->faker->realText(),
|
||||
'has_reminder' => false,
|
||||
'happened_at_month_unknown' => false,
|
||||
'happened_at_day_unknown' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getRandomGender()
|
||||
{
|
||||
return $this->account->genders->random();
|
||||
}
|
||||
|
||||
public function confirmUser($user)
|
||||
{
|
||||
$user->markEmailAsVerified();
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Tests;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Services\User\AcceptPolicy;
|
||||
|
||||
class SetupFrontEndTestUser extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'setup:frontendtestuser {--database= : The database connection to use}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a user exclusively for front-end testing with Cypress.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
app('migrator')->setConnection($this->option('database'));
|
||||
|
||||
$user = factory(User::class)->create();
|
||||
$user->account->populateDefaultFields();
|
||||
|
||||
app(AcceptPolicy::class)->execute([
|
||||
'account_id' => $user->account->id,
|
||||
'user_id' => $user->id,
|
||||
'ip_address' => null,
|
||||
]);
|
||||
|
||||
$this->info($user->getKey());
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Tests;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use function Safe\json_decode;
|
||||
use function Safe\json_encode;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class UpdateLangs extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'setup:updatelang';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update langage files.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
if (! File::exists(base_path('vendor/laravel-lang/lang'))) {
|
||||
throw new \Exception("This command requires laravel-lang/lang package. Run 'composer require --dev laravel-lang/lang' to install it.");
|
||||
}
|
||||
|
||||
$en = json_decode(File::get(lang_path('en.json')), true);
|
||||
|
||||
foreach (File::directories(lang_path()) as $lang) {
|
||||
$lang = basename($lang);
|
||||
$locale = Str::of($lang)->replace('-', '_');
|
||||
switch ($lang) {
|
||||
case 'zh':
|
||||
$locale = 'zh_CN';
|
||||
break;
|
||||
case 'en':
|
||||
continue 2;
|
||||
}
|
||||
if (File::exists($orig_path = lang_path("$lang.json"))
|
||||
&& File::exists($trans_path = base_path("vendor/laravel-lang/lang/locales/$locale/$locale.json"))) {
|
||||
$lang_orig = json_decode(File::get($orig_path), true);
|
||||
$lang_trans = json_decode(File::get($trans_path), true);
|
||||
foreach ($en as $key) {
|
||||
$lang_orig[$key] = $lang_trans[$key];
|
||||
}
|
||||
File::put($orig_path, json_encode($lang_orig, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Helpers\DBHelper;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
|
||||
class Update extends Command
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:update
|
||||
{--force : Force the operation to run when in production.}
|
||||
{--composer-install : Updating composer dependencies.}
|
||||
{--skip-storage-link : Skip storage link create.}
|
||||
{--dev : Install dev dependencies too.}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update monica dependencies and migrations after a new release';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->confirmToProceed()) {
|
||||
try {
|
||||
$this->artisan('✓ Maintenance mode: on', 'down', [
|
||||
'--retry' => '10',
|
||||
]);
|
||||
|
||||
// Clear or rebuild all cache
|
||||
if (config('cache.default') != 'database' || Schema::hasTable(config('cache.stores.database.table'))) {
|
||||
$this->artisan('✓ Resetting application cache', 'cache:clear');
|
||||
}
|
||||
|
||||
if ($this->getLaravel()->environment() == 'production') {
|
||||
$this->artisan('✓ Clear config cache', 'config:clear');
|
||||
$this->artisan('✓ Resetting route cache', 'route:cache');
|
||||
if ($this->getLaravel()->version() > '5.6') {
|
||||
$this->artisan('✓ Resetting view cache', 'view:cache');
|
||||
} else {
|
||||
$this->artisan('✓ Resetting view cache', 'view:clear');
|
||||
}
|
||||
} else {
|
||||
$this->artisan('✓ Clear config cache', 'config:clear');
|
||||
$this->artisan('✓ Clear route cache', 'route:clear');
|
||||
$this->artisan('✓ Clear view cache', 'view:clear');
|
||||
}
|
||||
|
||||
if ($this->option('composer-install') === true) {
|
||||
$this->exec('✓ Updating composer dependencies', 'composer install --no-interaction'.($this->option('dev') === false ? ' --no-dev' : ''));
|
||||
}
|
||||
|
||||
if ($this->option('skip-storage-link') !== true && $this->getLaravel()->environment() != 'testing' && ! file_exists(public_path('storage'))) {
|
||||
$this->artisan('✓ Symlink the storage folder', 'storage:link');
|
||||
}
|
||||
|
||||
if ($this->migrateCollationTest()) {
|
||||
$this->artisan('✓ Performing collation migrations', 'migrate:collation', ['--force']);
|
||||
}
|
||||
|
||||
$this->artisan('✓ Performing migrations', 'migrate', ['--force']);
|
||||
|
||||
$this->artisan('✓ Check for encryption keys', 'monica:passport', ['--force']);
|
||||
|
||||
$this->artisan('✓ Ping for new version', 'monica:ping', ['--force']);
|
||||
|
||||
// Cache config
|
||||
if ($this->getLaravel()->environment() == 'production'
|
||||
&& (config('cache.default') != 'database' || Schema::hasTable(config('cache.stores.database.table')))) {
|
||||
$this->artisan('✓ Cache configuraton', 'config:cache');
|
||||
}
|
||||
} finally {
|
||||
$this->artisan('✓ Maintenance mode: off', 'up');
|
||||
}
|
||||
|
||||
$this->line('Monica v'.config('monica.app_version').' is set up, enjoy.');
|
||||
}
|
||||
}
|
||||
|
||||
private function migrateCollationTest()
|
||||
{
|
||||
$connection = DBHelper::connection();
|
||||
|
||||
if ($connection->getDriverName() != 'mysql') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$databasename = $connection->getDatabaseName();
|
||||
|
||||
$schemata = DB::select(
|
||||
'select DEFAULT_CHARACTER_SET_NAME from information_schema.schemata where schema_name = ?',
|
||||
[$databasename]
|
||||
);
|
||||
|
||||
$schema = $schemata[0]->DEFAULT_CHARACTER_SET_NAME;
|
||||
|
||||
return config('database.use_utf8mb4') && $schema == 'utf8'
|
||||
|| ! config('database.use_utf8mb4') && $schema == 'utf8mb4';
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\Avatars\UpdateAllGravatars;
|
||||
|
||||
class UpdateGravatars extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monica:updategravatars';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update all gravatars';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
UpdateAllGravatars::dispatch();
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Scheduling\CronEvent;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the Closure based commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
$this->load(__DIR__.'/Commands/OneTime');
|
||||
|
||||
if ($this->app->environment() != 'production') {
|
||||
$this->load(__DIR__.'/Commands/Tests');
|
||||
}
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$this->scheduleCommand($schedule, 'queue:prune-batches', 'daily');
|
||||
$this->scheduleCommand($schedule, 'send:reminders', 'hourly');
|
||||
$this->scheduleCommand($schedule, 'send:stay_in_touch', 'hourly');
|
||||
$this->scheduleCommand($schedule, 'monica:davclients', 'hourly');
|
||||
$this->scheduleCommand($schedule, 'monica:calculatestatistics', 'daily');
|
||||
$this->scheduleCommand($schedule, 'monica:ping', 'daily');
|
||||
$this->scheduleCommand($schedule, 'monica:clean', 'daily');
|
||||
$this->scheduleCommand($schedule, 'monica:updategravatars', 'weekly');
|
||||
if (config('app.cloudflare')) {
|
||||
$this->scheduleCommand($schedule, 'cloudflare:reload', 'daily');
|
||||
}
|
||||
$this->scheduleCommand($schedule, 'model:prune', 'daily');
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a new schedule command with a frequency.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function scheduleCommand(Schedule $schedule, string $command, $frequency)
|
||||
{
|
||||
$schedule->command($command)->when(function () use ($command, $frequency) {
|
||||
$event = CronEvent::command($command);
|
||||
if ($frequency) {
|
||||
$event = $event->$frequency();
|
||||
}
|
||||
|
||||
return $event->isDue();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Scheduling;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Instance\Cron;
|
||||
|
||||
class CronEvent
|
||||
{
|
||||
/**
|
||||
* The cron model.
|
||||
*
|
||||
* @var Cron
|
||||
*/
|
||||
private $cron;
|
||||
|
||||
/**
|
||||
* Frequency to run the command in minutes.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $minutes = 1;
|
||||
|
||||
/**
|
||||
* Frequency to run the command in days.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $days = 0;
|
||||
|
||||
public function __construct(Cron $cron)
|
||||
{
|
||||
$this->cron = $cron;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command.
|
||||
*
|
||||
* @param string $command
|
||||
* @return self
|
||||
*/
|
||||
public static function command(string $command): self
|
||||
{
|
||||
/** @var \App\Models\Instance\Cron $cron */
|
||||
$cron = Cron::firstOrCreate(['command' => $command]);
|
||||
|
||||
return new self($cron);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current Cron.
|
||||
*
|
||||
* @return Cron
|
||||
*/
|
||||
public function cron()
|
||||
{
|
||||
return $this->cron;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the command once per hour.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function hourly(): self
|
||||
{
|
||||
$this->minutes = 60;
|
||||
$this->days = 0;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the command once per day.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function daily(): self
|
||||
{
|
||||
$this->minutes = 0;
|
||||
$this->days = 1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the command once a week.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function weekly(): self
|
||||
{
|
||||
$this->minutes = 0;
|
||||
$this->days = 7;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the command is due to run.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDue(): bool
|
||||
{
|
||||
$now = now();
|
||||
|
||||
if ($this->cron->last_run !== null) {
|
||||
$t = $this->cron->last_run;
|
||||
|
||||
if ($this->minutes !== 0) {
|
||||
$next_run = Carbon::create($t->year, $t->month, $t->day, $t->hour, (int) floor($t->minute / $this->minutes) * $this->minutes, 0)
|
||||
->addMinutes($this->minutes);
|
||||
} elseif ($this->days !== 0) {
|
||||
$next_run = Carbon::create($t->year, $t->month, (int) floor($t->day / $this->days) * $this->days, 0, 0, 0)
|
||||
->addDays($this->days);
|
||||
}
|
||||
|
||||
if (! isset($next_run) || $next_run > $now) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->cron->update(['last_run' => $now]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MoveAvatarEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The contact.
|
||||
*
|
||||
* @var Contact
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Contact $contact
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($contact)
|
||||
{
|
||||
$this->contact = $contact;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RecoveryLogin extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The authenticated user.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Authenticatable
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\User\SyncToken;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TokenDeleteEvent extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The deleted token.
|
||||
*
|
||||
* @var SyncToken
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param SyncToken $token
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException as FileNotFoundExceptionBase;
|
||||
|
||||
class FileNotFoundException extends FileNotFoundExceptionBase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fileName;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'File not found: '.$this->fileName;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Throwable;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
OAuthServerException::class,
|
||||
WrongIdException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
if (config('monica.sentry_support') && config('app.env') == 'production') {
|
||||
$this->reportable(function (Throwable $e) {
|
||||
if ($this->shouldReport($e) && app()->bound('sentry')) {
|
||||
app('sentry')->captureException($e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $e
|
||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function render($request, Throwable $e)
|
||||
{
|
||||
// hopefully catches those pesky token expiries
|
||||
// and send them back to login.
|
||||
if ($e instanceof TokenMismatchException) {
|
||||
return redirect()->route('loginRedirect');
|
||||
}
|
||||
|
||||
// Convert all non-http exceptions to a proper 500 http exception
|
||||
// if we don't do this exceptions are shown as a default template
|
||||
// instead of our own view in resources/views/errors/500.blade.php
|
||||
if ($this->shouldReport($e) && ! $this->isHttpException($e) && ! config('app.debug')) {
|
||||
$e = new HttpException(500, $e->getMessage());
|
||||
}
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception thrown if the env variable is not set or does not exist.
|
||||
*/
|
||||
class MissingEnvVariableException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception thrown if the env variable is not set or does not exist.
|
||||
*/
|
||||
class NoAccountException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class NoCoordinatesException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class RateLimitedSecondException extends RuntimeException
|
||||
{
|
||||
public function __construct($e)
|
||||
{
|
||||
parent::__construct('', 429, $e);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception thrown by Stripe.
|
||||
*/
|
||||
class StripeException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception thrown by IdHasher if a desired key item is wrong.
|
||||
*/
|
||||
class WrongIdException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Exception thrown if the given value is not in the list of authorized values.
|
||||
*/
|
||||
class WrongValueException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\Models\Contact\Gender;
|
||||
use App\ExportResources\User\User;
|
||||
use App\ExportResources\User\Module;
|
||||
use App\ExportResources\ExportResource;
|
||||
use App\ExportResources\Contact\Contact;
|
||||
use App\ExportResources\Contact\Document;
|
||||
use App\ExportResources\Instance\AuditLog;
|
||||
use App\ExportResources\Journal\JournalEntry;
|
||||
use App\ExportResources\Contact\ContactFieldType;
|
||||
use App\ExportResources\Relationship\Relationship;
|
||||
use App\ExportResources\Contact\Gender as GenderResource;
|
||||
|
||||
class Account extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'number_of_invitations_sent',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'data' => [
|
||||
User::countCollection($this->users),
|
||||
Contact::countCollection($this->allContacts),
|
||||
Relationship::countCollection($this->relationships),
|
||||
Addressbook::countCollection($this->addressBooks),
|
||||
AddressbookSubscription::countCollection($this->addressBookSubscriptions),
|
||||
Photo::countCollection($this->photos),
|
||||
Document::countCollection($this->documents),
|
||||
Activity::countCollection($this->activities),
|
||||
],
|
||||
'properties' => [
|
||||
'default_gender' => $this->when($this->default_gender_id !== null, function () {
|
||||
$defaultGender = Gender::where(['account_id' => $this->id])->find($this->default_gender_id);
|
||||
|
||||
return $defaultGender->uuid;
|
||||
}),
|
||||
'journal_entries' => JournalEntry::collection($this->journalEntries()->entry()->get()),
|
||||
'modules' => Module::collection($this->modules),
|
||||
'reminder_rules' => ReminderRule::collection($this->reminderRules),
|
||||
'audit_logs' => AuditLog::collection($this->auditLogs),
|
||||
],
|
||||
'instance' => [
|
||||
'activity_types' => ActivityType::collection($this->activityTypes),
|
||||
'activity_type_categories' => ActivityTypeCategory::collection($this->activityTypeCategories),
|
||||
'contact_field_types' => ContactFieldType::collection($this->contactFieldTypes),
|
||||
'genders' => GenderResource::collection($this->genders),
|
||||
'life_event_types' => LifeEventType::collection($this->lifeEventTypes),
|
||||
'life_event_categories' => LifeEventCategory::collection($this->lifeEventCategories),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Activity extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'summary',
|
||||
'description',
|
||||
'happened_at',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen($this->type !== null, function () {
|
||||
return [
|
||||
'type' => $this->type->uuid,
|
||||
];
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class ActivityType extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'translation_key',
|
||||
'name',
|
||||
'location_type',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen($this->category !== null, function () {
|
||||
return [
|
||||
'category' => $this->category->uuid,
|
||||
];
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class ActivityTypeCategory extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'translation_key',
|
||||
'name',
|
||||
];
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Addressbook extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'name',
|
||||
'description',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'user' => $this->user->uuid,
|
||||
'contacts' => $this->contacts->mapUuid(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\Models\User\SyncToken;
|
||||
use App\ExportResources\ExportResource;
|
||||
use App\ExportResources\User\SyncToken as SyncTokenResource;
|
||||
|
||||
class AddressbookSubscription extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'name',
|
||||
'uri',
|
||||
'username',
|
||||
'readonly',
|
||||
'active',
|
||||
'capabilities',
|
||||
'frequency',
|
||||
'last_syncronized_at',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'addressbook' => $this->addressBook->uuid,
|
||||
'sync_token' => $this->syncToken,
|
||||
$this->merge(function () {
|
||||
$localSyncToken = SyncToken::where('account_id', $this->account_id)->find($this->localSyncToken);
|
||||
|
||||
return [
|
||||
'local_sync_token' => new SyncTokenResource($localSyncToken),
|
||||
];
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class LifeEventCategory extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'core_monica_data',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'translation_key' => $this->default_life_event_category_key,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class LifeEventType extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'name',
|
||||
'core_monica_data',
|
||||
'specific_information_structure',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'translation_key' => $this->default_life_event_type_key,
|
||||
$this->mergeWhen($this->lifeEventCategory !== null, function () {
|
||||
return [
|
||||
'category' => $this->lifeEventCategory->uuid,
|
||||
];
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Photo extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'original_filename',
|
||||
'filesize',
|
||||
'mime_type',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'dataUrl' => $this->dataUrl(),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Account;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class ReminderRule extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'number_of_days_before',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'active',
|
||||
];
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Address extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'street' => $this->place->street,
|
||||
'city' => $this->place->city,
|
||||
'province' => $this->place->province,
|
||||
'postal_code' => $this->place->postal_code,
|
||||
'latitude' => $this->place->latitude,
|
||||
'longitude' => $this->place->longitude,
|
||||
'country' => $this->place->country,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Call extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'called_at',
|
||||
'content',
|
||||
'contact_called',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen($this->emotions->count() > 0, [
|
||||
'emotions' => $this->emotions->map(function ($emotion) {
|
||||
return $emotion->name;
|
||||
})->toArray(),
|
||||
]),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\Account\Photo;
|
||||
use App\ExportResources\ExportResource;
|
||||
use App\ExportResources\Account\Activity;
|
||||
use App\ExportResources\Instance\SpecialDate;
|
||||
use App\Models\Contact\Reminder as ContactReminder;
|
||||
|
||||
class Contact extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'first_name',
|
||||
'middle_name',
|
||||
'last_name',
|
||||
'nickname',
|
||||
'description',
|
||||
'is_starred',
|
||||
'is_partial',
|
||||
'is_active',
|
||||
'is_dead',
|
||||
'job',
|
||||
'company',
|
||||
'food_preferences',
|
||||
'last_talked_to',
|
||||
'last_consulted_at',
|
||||
'number_of_views',
|
||||
'stay_in_touch_frequency',
|
||||
'stay_in_touch_trigger_date',
|
||||
'vcard',
|
||||
'distant_etag',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'avatar' => [
|
||||
'avatar_source' => $this->avatar_source,
|
||||
'avatar_gravatar_url' => $this->avatar_gravatar_url,
|
||||
'avatar_adorable_uuid' => $this->avatar_adorable_uuid,
|
||||
'avatar_default_url' => $this->avatar_default_url,
|
||||
$this->mergeWhen($this->avatarPhoto !== null, function () {
|
||||
return ['avatar_photo' => $this->avatarPhoto->uuid];
|
||||
}),
|
||||
'has_avatar' => $this->has_avatar,
|
||||
'avatar_external_url' => $this->avatar_external_url,
|
||||
'avatar_file_name' => $this->avatar_file_name,
|
||||
'avatar_location' => $this->avatar_location,
|
||||
'gravatar_url' => $this->gravatar_url,
|
||||
'default_avatar_color' => $this->default_avatar_color,
|
||||
],
|
||||
'tags' => $this->when($this->tags->count() > 0, function () {
|
||||
return $this->tags->map(function ($tag) {
|
||||
return $tag->name;
|
||||
})->toArray();
|
||||
}),
|
||||
$this->mergeWhen($this->gender !== null, function () {
|
||||
return ['gender' => $this->gender->uuid];
|
||||
}),
|
||||
$this->mergeWhen($this->birthdate, [
|
||||
'birthdate' => new SpecialDate($this->birthdate),
|
||||
]),
|
||||
$this->mergeWhen($this->deceasedDate, [
|
||||
'deceased_date' => new SpecialDate($this->deceasedDate),
|
||||
]),
|
||||
$this->mergeWhen($this->deceased_reminder_id, function () {
|
||||
return ['deceased_reminder' => new Reminder(ContactReminder::find($this->deceased_reminder_id))];
|
||||
}),
|
||||
$this->mergeWhen($this->firstMetDate, [
|
||||
'first_met_date' => new SpecialDate($this->firstMetDate),
|
||||
]),
|
||||
$this->mergeWhen($this->getIntroducer() !== null, function () {
|
||||
return ['first_met_through' => $this->getIntroducer()->uuid];
|
||||
}),
|
||||
$this->mergeWhen($this->first_met_reminder_id !== null, function () {
|
||||
return ['first_met_reminder' => new Reminder(ContactReminder::find($this->first_met_reminder_id))];
|
||||
}),
|
||||
],
|
||||
'data' => [
|
||||
Call::countCollection($this->calls),
|
||||
ContactField::countCollection($this->contactFields),
|
||||
Debt::countCollection($this->debts),
|
||||
Gift::countCollection($this->gifts),
|
||||
Note::countCollection($this->notes),
|
||||
Reminder::countCollection($this->reminders),
|
||||
Task::countCollection($this->tasks),
|
||||
Address::countCollection($this->addresses),
|
||||
Pet::countCollection($this->pets),
|
||||
Conversation::countCollection($this->conversations),
|
||||
LifeEvent::countCollection($this->lifeEvents),
|
||||
Activity::uuidCollection($this->activities),
|
||||
Photo::uuidCollection($this->photos),
|
||||
Document::uuidCollection($this->documents),
|
||||
// Occupation::collection($this->occupations),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class ContactField extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'data',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen($this->contactFieldType !== null, function () {
|
||||
return ['type' => $this->contactFieldType->uuid];
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class ContactFieldType extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'name',
|
||||
'fontawesome_icon',
|
||||
'protocol',
|
||||
'delible',
|
||||
'type',
|
||||
];
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Conversation extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'happened_at',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen($this->contactFieldType !== null, function () {
|
||||
return ['contact_field_type' => $this->contactFieldType->uuid];
|
||||
}),
|
||||
'messages' => Message::collection($this->messages),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Debt extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'amount',
|
||||
'currency',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
'in_debt' => $this->in_debt === 'yes',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\ExportResources\Contact;
|
||||
|
||||
use App\ExportResources\ExportResource;
|
||||
|
||||
class Document extends ExportResource
|
||||
{
|
||||
protected $columns = [
|
||||
'uuid',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $properties = [
|
||||
'original_filename',
|
||||
'filesize',
|
||||
'type',
|
||||
'mime_type',
|
||||
'number_of_downloads',
|
||||
];
|
||||
|
||||
public function data(): ?array
|
||||
{
|
||||
return [
|
||||
'properties' => [
|
||||
$this->mergeWhen(($dataUrl = $this->dataUrl()) !== null, [
|
||||
'dataUrl' => $dataUrl,
|
||||
]),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user