diff --git a/CHANGELOG.md b/CHANGELOG.md index 612a867d0..0327239a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.10...dev) ### Added - Autocomplete Support (hashtags + mentions) ([de514f7d](https://github.com/pixelfed/pixelfed/commit/de514f7d)) +- Creative Commons Licenses ([552e950](https://github.com/pixelfed/pixelfed/commit/552e950)) ### Updated - Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940)) @@ -403,7 +404,7 @@ - Updated CollectionController, increase limit from 18 to 50. ([c2826fd3](https://github.com/pixelfed/pixelfed/c2826fd3)) ## Deprecated - + ## [v0.10.6 (2019-09-30)](https://github.com/pixelfed/pixelfed/compare/v0.10.5...v0.10.6) @@ -468,7 +469,7 @@ - Run ```php artisan passport:keys``` - Add ```OAUTH_ENABLED=true``` to .env - Run ```php artisan config:cache``` - + ## [v0.10.5 (2019-09-24)](https://github.com/pixelfed/pixelfed/compare/v0.10.4...v0.10.5) @@ -479,8 +480,8 @@ - Fixed cache bug in privacy and terms pages [#1712](https://github.com/pixelfed/pixelfed/commit/fe522da8db7a8b0d7c18d405abcb885f8678f35c) ### Changed - - + + ## [v0.10.4 (2019-09-24)](https://github.com/pixelfed/pixelfed/compare/v0.10.3...v0.10.4) ### Added @@ -511,17 +512,17 @@ ## Deprecated - Remove deprecated profile following/followers [#1697](https://github.com/pixelfed/pixelfed/pull/1697) - Remove old comment permalink [05f6598](https://github.com/pixelfed/pixelfed/pull/1708/commits/05f659896d903e1ff41dba810f125d721fa057e7) - - + + ## [v0.10.3 (2019-09-08)](https://github.com/pixelfed/pixelfed/compare/v0.10.2...v0.10.3) ### Added - Append ```.json``` to local status urls to view ActivityPub object [#1666](https://github.com/pixelfed/pixelfed/pull/1666) ### Fixed -- Reverted ```strict``` Same-Site Cookies to ```null``` to fix 2FA/session expiry [#1667](https://github.com/pixelfed/pixelfed/pull/1667) -- Fixed AP errors by storing ActivityPub object id and url [#1668](https://github.com/pixelfed/pixelfed/pull/1668) [#1683](https://github.com/pixelfed/pixelfed/pull/1683) -- Fixed content warnings that had filter applied [#1669](https://github.com/pixelfed/pixelfed/pull/1669) +- Reverted ```strict``` Same-Site Cookies to ```null``` to fix 2FA/session expiry [#1667](https://github.com/pixelfed/pixelfed/pull/1667) +- Fixed AP errors by storing ActivityPub object id and url [#1668](https://github.com/pixelfed/pixelfed/pull/1668) [#1683](https://github.com/pixelfed/pixelfed/pull/1683) +- Fixed content warnings that had filter applied [#1669](https://github.com/pixelfed/pixelfed/pull/1669) ### Changed - Japanese Translations [#1673](https://github.com/pixelfed/pixelfed/pull/1673) @@ -531,7 +532,7 @@ ### Deprecated - Personalized Discover has been deprecated due to low use [#1670](https://github.com/pixelfed/pixelfed/pull/1670) - + ## [v0.10.2 (2019-09-06)](https://github.com/pixelfed/pixelfed/compare/v0.10.1...v0.10.2) @@ -551,7 +552,7 @@ - Loops! Discover short videos - Preliminary support for profile PropertyValue metadata - Preliminary support for Direct Messages -- Places! Run the artisan task `import:cities` +- Places! Run the artisan task `import:cities` - Emails are now validated and banned email domains are disallowed at signup. Artisan task `email:bancheck` will validate existing users. - .env vars `REDIS_SCHEME` and `REDIS_PATH` allow for using Redis over a Unix socket instead of TCP [#1602](https://github.com/pixelfed/pixelfed/pull/1602) - .env var `IMAGE_DRIVER` allows using imagick instead of gd @@ -574,7 +575,7 @@ - Sample nginx.conf in contrib/ now uses HTTPS instead of HTTP. Docs updated to reference this file - Updated register form - Allow users to edit email after registrations - + ## [v0.10.0 (2019-07-17)](https://github.com/pixelfed/pixelfed/compare/v0.9.6...v0.10.0) @@ -595,7 +596,7 @@ ### Fixed - Hashtag post count off-by-one [#1485](https://github.com/pixelfed/pixelfed/pull/1485) - + ## [v0.9.5 (2019-07-10)](https://github.com/pixelfed/pixelfed/compare/v0.9.4...v0.9.5) @@ -631,8 +632,8 @@ ### Removed - Remove Classic Compose UI [#1434](https://github.com/pixelfed/pixelfed/pull/1434), [72bffd1](https://github.com/pixelfed/pixelfed/commit/72bffd1) [a2640af](https://github.com/pixelfed/pixelfed/commit/a2640af) -- - +- + ## [v0.9.4 (2019-06-03)](https://github.com/pixelfed/pixelfed/compare/v0.9.0...v0.9.4) @@ -672,7 +673,7 @@ php artisan config:cache ### Removed - Google Recaptcha is no longer supported (#1231) - Lightbox has been deprecated in favor of double-tap-to-like; it will return as a dedicated button in the future (#1277) - + ## [v0.9.0 (2019-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.8.6...v0.9.0) @@ -698,7 +699,7 @@ php artisan config:cache ### Removed - Removed identicons due to SVG compatibility issues with federation. New users will instead be assigned a default avatar. - + ## [v0.8.6 (2019-04-06)](https://github.com/pixelfed/pixelfed/compare/v0.8.5...v0.8.6) diff --git a/app/Http/Controllers/ComposeController.php b/app/Http/Controllers/ComposeController.php index 35bba5c9a..6d62ab07d 100644 --- a/app/Http/Controllers/ComposeController.php +++ b/app/Http/Controllers/ComposeController.php @@ -45,6 +45,7 @@ use App\Services\ServiceService; use Illuminate\Support\Str; use App\Util\Lexer\Autolink; use App\Util\Lexer\Extractor; +use App\Util\Media\License; class ComposeController extends Controller { @@ -407,6 +408,7 @@ class ComposeController extends Controller 'place' => 'nullable', 'comments_disabled' => 'nullable', 'tagged' => 'nullable', + 'license' => 'nullable|integer|min:1|max:16' // 'optimize_media' => 'nullable' ]); @@ -439,6 +441,8 @@ class ComposeController extends Controller abort_if($limitReached == true, 429); + $license = in_array($request->input('license'), License::keys()) ? $request->input('license') : null; + $visibility = $request->input('visibility'); $medias = $request->input('media'); $attachments = []; @@ -458,7 +462,7 @@ class ComposeController extends Controller abort(403, 'Invalid media id'); } $m->filter_class = in_array($media['filter_class'], Filter::classes()) ? $media['filter_class'] : null; - $m->license = $media['license']; + $m->license = $license; $m->caption = isset($media['alt']) ? strip_tags($media['alt']) : null; $m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k; // if($optimize_media == false) { diff --git a/app/Media.php b/app/Media.php index 3854c3848..107f15b4d 100644 --- a/app/Media.php +++ b/app/Media.php @@ -4,6 +4,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use App\Util\Media\License; use Storage; class Media extends Model @@ -101,4 +102,25 @@ class Media extends Model return $meta['Model']; } } + + public function getLicense() + { + $license = $this->license; + + if(!$license || strlen($license) > 2 || $license == 1) { + return null; + } + + if(!in_array($license, License::keys())) { + return null; + } + + $res = License::get()[$license]; + + return [ + 'id' => $res['id'], + 'title' => $res['title'], + 'url' => $res['url'] + ]; + } } diff --git a/app/Transformer/Api/MediaDraftTransformer.php b/app/Transformer/Api/MediaDraftTransformer.php index bb531f556..1f6c578c0 100644 --- a/app/Transformer/Api/MediaDraftTransformer.php +++ b/app/Transformer/Api/MediaDraftTransformer.php @@ -10,14 +10,6 @@ class MediaDraftTransformer extends Fractal\TransformerAbstract { public function transform(Media $media) { - - $url = URL::temporarySignedRoute( - 'temp-media', now()->addHours(1), ['profileId' => $media->profile_id, 'mediaId' => $media->id, 'timestamp' => time()] - ); - - //$url = $media->thumbnailUrl(); - //$url = $media->url(); - return [ 'id' => (string) $media->id, 'type' => $media->activityVerb(), diff --git a/app/Transformer/Api/MediaTransformer.php b/app/Transformer/Api/MediaTransformer.php index a5d0a0adb..21c0b25b5 100644 --- a/app/Transformer/Api/MediaTransformer.php +++ b/app/Transformer/Api/MediaTransformer.php @@ -15,10 +15,11 @@ class MediaTransformer extends Fractal\TransformerAbstract 'url' => $media->url(), 'remote_url' => null, 'preview_url' => $media->thumbnailUrl(), + 'optimized_url' => $media->optimized_url, 'text_url' => null, 'meta' => null, 'description' => $media->caption, - 'license' => $media->license, + 'license' => $media->getLicense(), 'is_nsfw' => $media->is_nsfw, 'orientation' => $media->orientation, 'filter_name' => $media->filter_name, diff --git a/app/Util/Media/License.php b/app/Util/Media/License.php new file mode 100644 index 000000000..653013a4d --- /dev/null +++ b/app/Util/Media/License.php @@ -0,0 +1,123 @@ + [ + "id" => 1, + "title" => "All Rights Reserved", + "name" => "All Rights Reserved", + "description" => "You, the copyright holder, reserve all rights provided by copyright law, such as the right to make copies, distribute your work, perform your work, license, or otherwise exploit your work; no rights are waived under this license.", + "terms" => [], + "url" => url('/site/kb/licenses') + ], + 5 => [ + "id" => 5, + "title" => "Public Domain", + "name" => "Public Domain Work", + "description" => "Works, or aspects of copyrighted works, which copyright law does not protect.", + "terms" => [], + "url" => url('/site/kb/licenses') + ], + 6 => [ + "id" => 6, + "title" => "Public Domain (CC0)", + "name" => "Public Domain Dedication (CC0)", + "description" => "You, the copyright holder, waive your interest in your work and place the work as completely as possible in the public domain so others may freely exploit and use the work without restriction under copyright or database law.", + "terms" => [], + "url" => url('/site/kb/licenses') + ], + 11 => [ + "id" => 11, + "title" => "CC BY", + "name" => "Attribution", + "description" => "This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use.", + "terms" => [ + "Credit must be given to the creator", + ], + "url" => "https://creativecommons.org/licenses/by/4.0/" + ], + 12 => [ + "id" => 12, + "title" => "CC BY-SA", + "name" => "Attribution-ShareAlike", + "description" => "This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.", + "terms" => [ + "Credit must be given to the creator", + "Adaptations must be shared under the same terms" + ], + "url" => "https://creativecommons.org/licenses/by-sa/4.0/" + ], + 13 => [ + "id" => 13, + "title" => "CC BY-NC", + "name" => "Attribution-NonCommercial", + "description" => "This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creator.", + "terms" => [ + "Credit must be given to the creator", + "Only noncommercial uses of the work are permitted" + ], + "url" => "https://creativecommons.org/licenses/by-nc/4.0/" + ], + 14 => [ + "id" => 14, + "title" => "CC BY-NC-SA", + "name" => "Attribution-NonCommercial-ShareAlike", + "description" => "This license allows reusers to distribute, remix, adapt, and build upon the material in any medium or format for noncommercial purposes only, and only so long as attribution is given to the creator. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.", + "terms" => [ + "Credit must be given to the creator", + "Only noncommercial uses of the work are permitted", + "Adaptations must be shared under the same terms" + ], + "url" => "https://creativecommons.org/licenses/by-nc-sa/4.0/" + ], + 15 => [ + "id" => 15, + "title" => "CC BY-ND", + "name" => "Attribution-NoDerivs", + "description" => "This license allows reusers to copy and distribute the material in any medium or format in unadapted form only, and only so long as attribution is given to the creator. The license allows for commercial use.", + "terms" => [ + "Credit must be given to the creator", + "No derivatives or adaptations of the work are permitted" + ], + "url" => "https://creativecommons.org/licenses/by-nd/4.0/" + ], + 16 => [ + "id" => 16, + "title" => "CC BY-NC-ND", + "name" => "Attribution-NonCommercial-NoDerivs", + "description" => "This license allows reusers to copy and distribute the material in any medium or format in unadapted form only, for noncommercial purposes only, and only so long as attribution is given to the creator.", + "terms" => [ + "Credit must be given to the creator", + "Only noncommercial uses of the work are permitted", + "No derivatives or adaptations of the work are permitted" + ], + "url" => "https://creativecommons.org/licenses/by-nc-nd/4.0/" + ] + ]; + } + + public static function keys() + { + return array_keys(self::get()); + } + + public static function getId($index) + { + return self::get()[$index]['id']; + } + + public static function names() + { + return collect(self::get()) + ->map(function($v) { + return $v['title']; + }) + ->values() + ->toArray(); + } +} diff --git a/public/js/compose.js b/public/js/compose.js index 1f3ff9799..e83d89dff 100644 Binary files a/public/js/compose.js and b/public/js/compose.js differ diff --git a/public/js/profile.js b/public/js/profile.js index e74c11967..4cc3b0c00 100644 Binary files a/public/js/profile.js and b/public/js/profile.js differ diff --git a/public/js/rempos.js b/public/js/rempos.js index 8c3861383..001c24a72 100644 Binary files a/public/js/rempos.js and b/public/js/rempos.js differ diff --git a/public/js/status.js b/public/js/status.js index f42352fe8..493beead1 100644 Binary files a/public/js/status.js and b/public/js/status.js differ diff --git a/public/js/timeline.js b/public/js/timeline.js index 9da486201..5ebe82173 100644 Binary files a/public/js/timeline.js and b/public/js/timeline.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index c57e5e887..77222962e 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index e2c054ac3..e118f189c 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -12,6 +12,7 @@ +
@@ -42,6 +43,7 @@
+
@@ -91,8 +93,21 @@
+
+
+
+ {{item.name}} +
+
+
- test
@@ -315,7 +330,10 @@
-

Tag people NEW

+

Tag people

+
+
+

Add license NEW

Add location

@@ -565,11 +583,19 @@
- -

+ + +

@@ -707,7 +733,8 @@ export default { 'editMedia', 'cameraRoll', 'tagPeopleHelp', - 'textOptions' + 'textOptions', + 'licensePicker' ], cameraRollMedia: [], taggedUsernames: [], @@ -744,7 +771,46 @@ export default { }) } ] - } + }, + availableLicenses: [ + { + id: 1, + name: "All Rights Reserved" + }, + { + id: 5, + name: "Public Domain Work" + }, + { + id: 6, + name: "Public Domain Dedication (CC0)" + }, + { + id: 11, + name: "Attribution" + }, + { + id: 12, + name: "Attribution-ShareAlike" + }, + { + id: 13, + name: "Attribution-NonCommercial" + }, + { + id: 14, + name: "Attribution-NonCommercial-ShareAlike" + }, + { + id: 15, + name: "Attribution-NoDerivs" + }, + { + id: 16, + name: "Attribution-NonCommercial-NoDerivs" + } + ], + licenseIndex: 0 } }, @@ -934,7 +1000,8 @@ export default { comments_disabled: this.commentsDisabled, place: this.place, tagged: this.taggedUsernames, - optimize_media: this.optimizeMedia + optimize_media: this.optimizeMedia, + license: this.availableLicenses[this.licenseIndex].id }; axios.post('/api/compose/v0/publish', data) .then(res => { @@ -1026,6 +1093,10 @@ export default { this.showTagCard(); break; + case 'licensePicker': + this.page = 3; + break; + default: this.namedPages.indexOf(this.page) != -1 ? this.page = (this.textMode ? 'addText' : 3) : @@ -1270,7 +1341,18 @@ export default { showTextOptions() { this.page = 'textOptions'; this.pageTitle = 'Text Post Options'; - } + }, + + showLicenseCard() { + this.pageTitle = 'Select a License'; + this.page = 'licensePicker'; + }, + + toggleLicense(index) { + this.licenseIndex = index; + this.pageTitle = ''; + this.page = 3; + }, } } \ No newline at end of file diff --git a/resources/assets/js/components/presenter/PhotoPresenter.vue b/resources/assets/js/components/presenter/PhotoPresenter.vue index 85f23e8a1..d350c7aea 100644 --- a/resources/assets/js/components/presenter/PhotoPresenter.vue +++ b/resources/assets/js/components/presenter/PhotoPresenter.vue @@ -22,7 +22,7 @@ :alt="altText(status)"/>
-
+
+ +

Photo by @{{status.account.username}} licensed under {{status.media_attachments[0].license.title}}