Skip to content

Commit

Permalink
Merge pull request #159 from Kovah/dev
Browse files Browse the repository at this point in the history
v0.0.43
  • Loading branch information
Kovah authored Nov 8, 2020
2 parents 11750d2 + 222e774 commit 5118801
Show file tree
Hide file tree
Showing 296 changed files with 3,518 additions and 2,617 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: New Feature
assignees: ''

---

**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 [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
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.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4']

name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# :construction: Contribution

If you want to contribute to the project please open a [ticket](https://github.com/Kovah/LinkAce/issues) first and
describe what you want to do or what your idea is. Maybe there already is an existing ticket for your or a very similar
topic.

I may decline contributions for features that may not fit into the application, so make sure to talk to me before
starting to code.

## Contribution Guidelines

* Always use the `dev` branch to work on the application. The dev branch will contain the latest version of the app
while the `master` branch may contains the stable version (which may be outdated in terms of development).
* Consider using a separate branch if you are working on a larger feature.
* Reference the issue number in your commits please.
* When opening a pull request, link to your ticket and describe what you did to solve the problem.
81 changes: 7 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* [About LinkAce](#about-linkace)
* [Support Disclaimer](#bulb-support-for-linkace)
* [Setup](#gear-setup)
* [Setup with Docker](#setup-with-docker)
* [Setup without Docker](#setup-without-docker)
* [Contribution](#construction-contribution)
* [Development](#development)

Expand Down Expand Up @@ -81,86 +79,21 @@ or **[Github Sponsor](https://github.com/sponsors/Kovah)**. :star:

### :gear: Setup

Please check if your server supports the [requirements](https://www.linkace.org/docs/v1/setup/) before starting the
setup.
LinkAce provides multiple ways of installing it on your server. The complete documentation for all installation
methods can be found [**in the wiki**](https://www.linkace.org/docs/v1/setup/).

#### Setup with Docker

Working with Docker is pretty straight forward. The image available on Docker Hub contains the application code, any
precompiled assets as well as PHP installed. This means you can use any web server you want, any cache driver you want
and any database system you want.

To make things easier, we provide a Docker Compose file (docker-compose.production.yml) in the repository which
contains all needed services, perfectly configured to run the application right away.

#### 1. Copy all needed files

All files you need are `docker-compose.production.yml`, `.env.docker` and `nginx.conf`. Copy both to the directory you
want to use for the application.

#### 2. Modify the .env.docker file

Make a copy of the `.env.docker.production` file and name it `.env`. By default, you must change two options
in this file before starting the setup:

* DB_PASSWORD - Please set a secure password here
* REDIS_PASSWORD - Please set a secure password here

#### 3. Start the application

After you completed the above steps, run the following command to start up the container setup:

```bash
docker-compose up -d
```

#### 4. Run the Setup

After you started the Docker containers, you are almost ready to run the setup. Before the setup, we have to generate
a secret key.
Please note that `linkace_php_1` is the name of your PHP container here. It may differ from your name. You will find
the name of your container in the output of the previous command, but will most likely end with `_php_1`.

```bash
docker-compose run php php artisan key:generate
```

Open the URL which points to your Docker container in your browser now. You have to configure the database, and your
user account in the following setup.

Please make sure to follow the post-installation tasks to fully enable all features. A guide can be found in the
[wiki](https://www.linkace.org/docs/v1/setup/post-setup).


#### Setup without Docker

The application was developed forthe usage with Docker. If you don't want to or can't use Docker, you can also run
LinkAce as a regular PHP application. Please notice that there won't be any support for custom environments,
unsupported PHP versions or help with setting up Apache or your nginx web server.

Please note that you **must have shell access to your server**. A shared hosting may not be suitable for this.

Follow the instructions in the [wiki](https://www.linkace.org/docs/v1/setup/setup-without-docker) to install
LinkAce without Docker.
* Setup with Docker (_recommended_)
* Simple setup with 1 Docker image
* Advanced setup with multiple Docker images
* Setup without Docker


---


### :construction: Contribution

If you want to contribute to the project please open a [ticket](https://github.com/Kovah/LinkAce/issues) first and
describe what you want to do or what your idea is. Maybe there already is an existing ticket for your or a very similar
topic.

I may decline contributions for features that may not fit into the application.

#### Some Contribution Guidelines

* Always use the `dev` branch to work on the application. The dev branch will contain the latest version of the app
while the `master` branch may contains the stable version (which may be outdated in terms of development).
* Consider using a separate branch if you are working on a larger feature.
* When opening a pull request, link to your ticket and describe what you did to solve the problem.
Please review the [**contribution guidelines**](CONTRIBUTING.md) before starting to work on any features.


### Development
Expand Down
190 changes: 83 additions & 107 deletions app/Helper/LinkIconMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,113 +10,89 @@
class LinkIconMapper
{
/** @var string Default icon as fallback if no specific icon was found */
public static $default_icon = 'fa fa-link';
public static $defaultIcon = 'link';

/** @var array Array holding the pattern => icon map, sorted alphabetically */
public static $icon_map = [
'500px\.com' => 'fab fa-500px',
'adobe\.com' => 'fab fa-adobe',
'aws\.amazon\.com' => 'fab fa-aws', // put before amazon pattern to keep it easy
'amazon\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'fab fa-amazon', // match amazon with every TLD
'angel\.co' => 'fab fa-angellist',
'itunes\.apple\.com\/app' => 'fab fa-app-store',
'apple\.com' => 'fab fa-apple',
'artstation\.com' => 'fab fa-artstation',
'atlassian\.(com|net)' => 'fab fa-atlassian',
'bandcamp\.com' => 'fab fa-bandcamp',
'behance\.net' => 'fab fa-behance',
'bitbucket\.org' => 'fab fa-bitbucket',
'blockchain\.com' => 'fab fa-bitcoin',
'blogger\.com' => 'fab fa-blogger-b',
'chrome\.google\.com\/webstore' => 'fab fa-chrome',
'codepen\.io' => 'fab fa-codepen',
'dev\.to' => 'fab fa-dev',
'deviantart\.com' => 'fab fa-deviantart',
'digitalocean\.com' => 'fab fa-digital-ocean',
'(discordapp\.com|discord\.gg)' => 'fab fa-discord',
'meta\.discourse\.org' => 'fab fa-discourse',
'docker\.com' => 'fab fa-docker',
'dribbble\.com' => 'fab fa-dribbble',
'dropbox\.com' => 'fab fa-dropbox',
'drupal\.org' => 'fab fa-drupal',
'ebay\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'fab fa-ebay',
'ello\.co' => 'fab fa-ello',
'etsy\.com' => 'fab fa-etsy',
'(facebook\.com|fb\.me)' => 'fab fa-facebook-f',
'addons\.mozilla\.org\/[a-zA-Z-_]+\/firefox' => 'fab fa-firefox',
'figma\.com' => 'fab fa-figma',
'flickr\.com' => 'fab fa-flickr',
'(flipboard\.com|flip\.it)' => 'fab fa-flipboard',
'foursquare\.com' => 'fab fa-foursquare',
'(getpocket\.com|pocket\.co)' => 'fab fa-get-pocket',
'(github\.com|github\.io)' => 'fab fa-github',
'gitlab\.com' => 'fab fa-gitlab',
'gitter\.im' => 'fab fa-gitter',
'drive\.google\.com' => 'fab fa-google-drive',
'play\.google\.com' => 'fab fa-google-play',
'google\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'fab fa-google',
'news\.ycombinator\.com' => 'fab fa-hacker-news',
'hackerrank\.com' => 'fab fa-hackerrank',
'houzz\.com' => 'fab fa-houzz',
'imdb\.com' => 'fab fa-imdb',
'instagram\.com' => 'fab fa-instagram',
'invisionapp\.com' => 'fab fa-invision',
'jsfiddle\.net' => 'fab fa-jsfiddle',
'kaggle\.com' => 'fab fa-kaggle',
'keybase\.io' => 'fab fa-keybase',
'kickstarter\.com' => 'fab fa-kickstarter',
'last\.fm' => 'fab fa-lastfm',
'leanpub\.com' => 'fab fa-leanpub',
'linkedin\.com' => 'fab fa-linkedin-in',
'mastodon\.social' => 'fab fa-mastodon',
'medium\.com' => 'fab fa-medium-m',
'meetup\.com' => 'fab fa-meetup',
'microsoft\.com' => 'fab fa-microsoft',
'mixcloud\.com' => 'fab fa-mixcloud',
'npmjs\.com' => 'fab fa-npm',
'openid\.net' => 'fab fa-openid',
'opensource\.org' => 'fab fa-osi',
'patreon\.com' => 'fab fa-patreon ',
'paypal\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'fab fa-paypal',
'periscope\.tv' => 'fab fa-periscope',
'php\.net' => 'fab fa-php',
'pinterest\.com' => 'fab fa-pinterest',
'playstation\.com' => 'fab fa-playstation',
'producthunt\.com' => 'fab fa-product-hunt',
'python\.org' => 'fab fa-python',
'quora\.com' => 'fab fa-quora',
'readme\.io' => 'fab fa-readme',
'reddit\.com' => 'fab fa-reddit',
'researchgate\.net' => 'fab fa-researchgate',
'rocket\.chat' => 'fab fa-rocketchat',
'scribd\.com' => 'fab fa-scribd',
'skype\.com' => 'fab fa-skype',
'slack\.com' => 'fab fa-slack',
'slideshare\.net' => 'fab fa-slideshare',
'snapchat\.com' => 'fab fa-snapchat',
'soundcloud\.com' => 'fab fa-soundcloud',
'spotify\.com' => 'fab fa-spotify',
'squarespace\.com' => 'fab fa-squarespace',
'stackexchange\.com' => 'fab fa-stack-exchange',
'stackoverflow\.com' => 'fab fa-stack-overflow',
'(steampowered\.com|steamcommunity\.com)' => 'fab fa-steam',
'strava\.com' => 'fab fa-strava',
'(telegram\.org|t\.me)' => 'fab fa-telegram',
'trello\.com' => 'fab fa-trello',
'tripadvisor\.com' => 'fab fa-tripadvisor',
'tumblr\.com' => 'fab fa-tumblr',
'twitch\.tv' => 'fab fa-twitch',
'twitter\.com' => 'fab fa-twitter',
'vimeo\.com' => 'fab fa-vimeo',
'weibo\.com' => 'fab fa-weibo',
'wikipedia\.org' => 'fab fa-wikipedia-w',
'wordpress\.com' => 'fab fa-wordpress',
'wordpress\.org' => 'fab fa-wordpress-simple',
'xbox\.com' => 'fab fa-xbox',
'xing\.com' => 'fab fa-xing',
'yahoo\.com' => 'fab fa-yahoo',
'yelp\.com' => 'fab fa-yelp',
'youtube\.com' => 'fab fa-youtube',
public static $iconMap = [
'500px\.com' => 'brand.500px',
'amazon\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'brand.amazon',
'itunes\.apple\.com\/app' => 'brand.app-store-ios',
'apple\.com' => 'brand.apple',
'artstation\.com' => 'brand.artstation',
'atlassian\.(com|net)' => 'brand.atlassian',
'bandcamp\.com' => 'brand.bandcamp',
'behance\.net' => 'brand.behance',
'bitbucket\.org' => 'brand.bitbucket',
'blockchain\.com' => 'brand.bitcoin',
'blogger\.com' => 'brand.blogger-b',
'chrome\.google\.com\/webstore' => 'brand.chrome',
'codepen\.io' => 'brand.codepen',
'dev\.to' => 'brand.dev',
'deviantart\.com' => 'brand.deviantart',
'(discordapp\.com|discord\.gg)' => 'brand.discord',
'docker\.com' => 'brand.docker',
'dribbble\.com' => 'brand.dribbble',
'dropbox\.com' => 'brand.dropbox',
'ebay\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'brand.ebay',
'etsy\.com' => 'brand.etsy',
'(facebook\.com|fb\.me)' => 'brand.facebook',
'addons\.mozilla\.org\/[a-zA-Z-_]+\/firefox' => 'brand.firefox',
'flickr\.com' => 'brand.flickr',
'(flipboard\.com|flip\.it)' => 'brand.flipboard',
'(getpocket\.com|pocket\.co)' => 'brand.get-pocket',
'(github\.com|github\.io)' => 'brand.github',
'gitlab\.com' => 'brand.gitlab',
'gitter\.im' => 'brand.gitter',
'drive\.google\.com' => 'brand.google-drive',
'play\.google\.com' => 'brand.google-play',
'google\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'brand.google',
'news\.ycombinator\.com' => 'brand.hacker-news',
'imdb\.com' => 'brand.imdb',
'instagram\.com' => 'brand.instagram',
'jsfiddle\.net' => 'brand.jsfiddle',
'keybase\.io' => 'brand.keybase',
'kickstarter\.com' => 'brand.kickstarter',
'last\.fm' => 'brand.lastfm',
'linkedin\.com' => 'brand.linkedin',
'mastodon\.social' => 'brand.mastodon',
'medium\.com' => 'brand.medium',
'meetup\.com' => 'brand.meetup',
'microsoft\.com' => 'brand.microsoft',
'mixcloud\.com' => 'brand.mixcloud',
'npmjs\.com' => 'brand.npm',
'openid\.net' => 'brand.openid',
'patreon\.com' => 'brand.patreon',
'paypal\.([a-zA-Z]*(\.)?[a-zA-Z]*)' => 'brand.paypal',
'php\.net' => 'brand.php',
'pinterest\.com' => 'brand.pinterest',
'playstation\.com' => 'brand.playstation',
'producthunt\.com' => 'brand.product-hunt',
'quora\.com' => 'brand.quora',
'reddit\.com' => 'brand.reddit',
'researchgate\.net' => 'brand.researchgate',
'skype\.com' => 'brand.skype',
'slack\.com' => 'brand.slack',
'slideshare\.net' => 'brand.slideshare',
'snapchat\.com' => 'brand.snapchat',
'soundcloud\.com' => 'brand.soundcloud',
'spotify\.com' => 'brand.spotify',
'stackexchange\.com' => 'brand.stack-exchange',
'stackoverflow\.com' => 'brand.stack-overflow',
'(steampowered\.com|steamcommunity\.com)' => 'brand.steam',
'(telegram\.org|t\.me)' => 'brand.telegram',
'trello\.com' => 'brand.trello',
'tripadvisor\.com' => 'brand.tripadvisor',
'tumblr\.com' => 'brand.tumblr',
'twitch\.tv' => 'brand.twitch',
'twitter\.com' => 'brand.twitter',
'vimeo\.com' => 'brand.vimeo',
'weibo\.com' => 'brand.weibo',
'wikipedia\.org' => 'brand.wikipedia-w',
'wordpress\.(com|org)' => 'brand.wordpress',
'xbox\.com' => 'brand.xbox',
'xing\.com' => 'brand.xing',
'yelp\.com' => 'brand.yelp',
'youtube\.com' => 'brand.youtube',
];

/**
Expand All @@ -127,12 +103,12 @@ class LinkIconMapper
*/
public static function mapLink(string $url): string
{
foreach (self::$icon_map as $pattern => $icon) {
foreach (self::$iconMap as $pattern => $icon) {
if (preg_match('/' . $pattern . '/i', $url)) {
return $icon;
}
}

return self::$default_icon;
return self::$defaultIcon;
}
}
Loading

0 comments on commit 5118801

Please sign in to comment.