Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
liyanqwq committed Mar 12, 2022
1 parent 1e5e2cf commit 433712d
Show file tree
Hide file tree
Showing 25 changed files with 5,509 additions and 2 deletions.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2022 liyan.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 26 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# flarum-cravatar
Cravatar for flarum
# Cravatar

A Cravatar Ext. for [Flarum](//flarum.org).

Modified from [ianm/gravatar](https://discuss.flarum.org/d/27930-gravatar).

### Installation

Install with composer:

```sh
composer require liyanqwq/cravatar:"*"
```

### Updating

```sh
composer update liyanqwq/cravatar:"*"
php flarum migrate
php flarum cache:clear
```

### Links

- [Packagist](https://packagist.org/packages/liyanqwq/cravatar)
- [GitHub](https://github.com/liyanqwq/flarum-cravatar)
42 changes: 42 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "liyanqwq/flarum-cravatar",
"description": "Add cravatar avatars to your forum",
"keywords": [
"flarum", "cravatar"
],
"type": "flarum-extension",
"license": "MIT",
"support": {
"source": "https://github.com/liyanqwq/flarum-cravatar"
},
"require": {
"php": "^7.4 || ^8.0",
"flarum/core": "^1.0.3",
"guzzlehttp/guzzle": "^7.0"
},
"authors": [
{
"name": "liyanqwq",
"homepage": "https://liyan.moe",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"IanM\\Gravatar\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "Cravatar",
"category": "feature",
"icon": {
"image": "resources/logo.svg",
"backgroundColor": "#0072e3",
"backgroundSize": "100%",
"backgroundRepeat": "no-repeat",
"backgroundPosition": "center"
}
}
}
}
42 changes: 42 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/*
* This file is part of ianm/gravatar.
*
* Copyright (c) 2021 IanM.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace IanM\Gravatar;

use Flarum\Api\Serializer\BasicUserSerializer;
use Flarum\Extend;
use IanM\Gravatar\Provider\GravatarProvider;

return [
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less'),

(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/resources/less/admin.less'),

(new Extend\Routes('api'))
->remove('users.avatar.upload')
->get(
'/users/{id}/gravatar.jpg',
'ianm.gravatar.image',
Api\Controllers\GetGravatarImageController::class
),

new Extend\Locales(__DIR__.'/resources/locale'),

(new Extend\ServiceProvider())
->register(GravatarProvider::class),

(new Extend\ApiSerializer(BasicUserSerializer::class))
->attributes(Api\AddGravatar::class),
];
6 changes: 6 additions & 0 deletions js/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 150,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
1 change: 1 addition & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/admin';
2 changes: 2 additions & 0 deletions js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/dist/admin.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions js/dist/forum.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 433712d

Please sign in to comment.