diff --git a/Dockerfile b/Dockerfile
index 892f260..9301d92 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@ FROM php:7.1-apache
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
RUN apt-get update \
- && apt-get install -y libpq-dev \
+ && apt-get install -y git libpq-dev \
&& docker-php-ext-install pdo_pgsql \
&& curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
diff --git a/README.md b/README.md
index 47c19a7..2a390a6 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,54 @@
-Tissue
-====
+# Tissue
a.k.a. shikorism.net
-シコリズムネットにて提供している夜のライフログサービスです。
+シコリズムネットにて提供している夜のライフログサービスです。
(思想的には [shibafu528/SperMaster](https://github.com/shibafu528/SperMaster) の後継となります)
## 構成
-* Laravel 5.5
-* Bootstrap 4.0
+
+- Laravel 5.5
+- Bootstrap 4.0
## 実行環境
-* PHP 7.1
-* PostgreSQL 9.6
+
+- PHP 7.1
+- PostgreSQL 9.6
+
+## 開発環境の構築
+
+Docker を用いた開発環境の構築方法です。
+
+1. `.env` ファイルを用意します。`.env.example` をコピーすることで用意ができます。
+
+2. Docker イメージをビルドします
+
+```
+docker-compose build
+```
+
+3. Docker コンテナを起動します。
+
+```
+docker-compose up -d
+```
+
+4. Composer を使い必要なライブラリをインストールします。
+
+```
+docker-compose exec web composer install
+```
+
+5. 暗号化キーの作成と、データベースのマイグレーションを行います。
+
+```
+docker-compose exec web php artisan key:generate
+docker-compose exec web php artisan migrate
+```
+
+これで準備は完了です。Tissue が動いていれば `http://localhost:4545/` でアクセスができます。
## 環境構築上の諸注意
-* 初版時点では、DBサーバとしてPostgreSQLを使うよう .env ファイルを設定するくらいです。
- 当分、PostgreSQLから変える気はないので専用SQL等を平気で使います。
+
+- 初版時点では、DB サーバとして PostgreSQL を使うよう .env ファイルを設定するくらいです。
+ 当分、PostgreSQL から変える気はないので専用 SQL 等を平気で使います。
diff --git a/app/Http/Controllers/EjaculationController.php b/app/Http/Controllers/EjaculationController.php
index 43b3d13..83f4dd9 100644
--- a/app/Http/Controllers/EjaculationController.php
+++ b/app/Http/Controllers/EjaculationController.php
@@ -38,7 +38,7 @@ class EjaculationController extends Controller
'date' => 'required|date_format:Y/m/d',
'time' => 'required|date_format:H:i',
'note' => 'nullable|string|max:500',
- 'link' => 'nullable|url',
+ 'link' => 'nullable|url|max:2000',
'tags' => 'nullable|string',
])->after(function ($validator) use ($request, $inputs) {
// 日時の重複チェック
@@ -120,7 +120,7 @@ class EjaculationController extends Controller
'date' => 'required|date_format:Y/m/d',
'time' => 'required|date_format:H:i',
'note' => 'nullable|string|max:500',
- 'link' => 'nullable|url',
+ 'link' => 'nullable|url|max:2000',
'tags' => 'nullable|string',
])->after(function ($validator) use ($id, $request, $inputs) {
// 日時の重複チェック
diff --git a/app/MetadataResolver/DLsiteResolver.php b/app/MetadataResolver/DLsiteResolver.php
new file mode 100644
index 0000000..866bde0
--- /dev/null
+++ b/app/MetadataResolver/DLsiteResolver.php
@@ -0,0 +1,22 @@
+get($url);
+ if ($res->getStatusCode() === 200) {
+ $ogpResolver = new OGPResolver();
+ $metadata = $ogpResolver->parse($res->getBody());
+ $metadata->image = str_replace("img_sam.jpg", "img_main.jpg", $metadata->image);
+ return $metadata;
+ } else {
+ throw new \RuntimeException("{$res->getStatusCode()}: $url");
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/MetadataResolver/MetadataResolver.php b/app/MetadataResolver/MetadataResolver.php
index dc4103c..8180589 100644
--- a/app/MetadataResolver/MetadataResolver.php
+++ b/app/MetadataResolver/MetadataResolver.php
@@ -11,6 +11,7 @@ class MetadataResolver implements Resolver
'~www\.melonbooks\.co\.jp/detail/detail\.php~' => MelonbooksResolver::class,
'~ec\.toranoana\.jp/tora_r/ec/item/.*~' => ToranoanaResolver::class,
'~iwara\.tv/videos/.*~' => IwaraResolver::class,
+ '~www\.dlsite\.com/.*/work/=/product_id/..\d+\.html~' => DLsiteResolver::class,
'/.*/' => OGPResolver::class
];
diff --git a/composer.json b/composer.json
index f894ca5..b309ae6 100644
--- a/composer.json
+++ b/composer.json
@@ -6,6 +6,7 @@
"type": "project",
"require": {
"php": ">=7.0.0",
+ "doctrine/dbal": "^2.9",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
diff --git a/composer.lock b/composer.lock
index ad43983..0d47d7a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "c0337b3aa8bbda1fb89875ff187e85e8",
+ "content-hash": "6ac4cd158b1f93a24e21fce57d4404c8",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@@ -39,6 +39,237 @@
"description": "implementation of xdg base directory specification for php",
"time": "2014-10-24T07:27:01+00:00"
},
+ {
+ "name": "doctrine/cache",
+ "version": "v1.8.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/cache.git",
+ "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/cache/zipball/d768d58baee9a4862ca783840eca1b9add7a7f57",
+ "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57",
+ "shasum": ""
+ },
+ "require": {
+ "php": "~7.1"
+ },
+ "conflict": {
+ "doctrine/common": ">2.2,<2.4"
+ },
+ "require-dev": {
+ "alcaeus/mongo-php-adapter": "^1.1",
+ "doctrine/coding-standard": "^4.0",
+ "mongodb/mongodb": "^1.1",
+ "phpunit/phpunit": "^7.0",
+ "predis/predis": "~1.0"
+ },
+ "suggest": {
+ "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.8.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Caching library offering an object-oriented API for many cache backends",
+ "homepage": "https://www.doctrine-project.org",
+ "keywords": [
+ "cache",
+ "caching"
+ ],
+ "time": "2018-08-21T18:01:43+00:00"
+ },
+ {
+ "name": "doctrine/dbal",
+ "version": "v2.9.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/dbal.git",
+ "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/dbal/zipball/22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9",
+ "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/cache": "^1.0",
+ "doctrine/event-manager": "^1.0",
+ "ext-pdo": "*",
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^5.0",
+ "jetbrains/phpstorm-stubs": "^2018.1.2",
+ "phpstan/phpstan": "^0.10.1",
+ "phpunit/phpunit": "^7.4",
+ "symfony/console": "^2.0.5|^3.0|^4.0",
+ "symfony/phpunit-bridge": "^3.4.5|^4.0.5"
+ },
+ "suggest": {
+ "symfony/console": "For helpful console commands such as SQL execution and import of files."
+ },
+ "bin": [
+ "bin/doctrine-dbal"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.9.x-dev",
+ "dev-develop": "3.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\DBAL\\": "lib/Doctrine/DBAL"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ }
+ ],
+ "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
+ "homepage": "https://www.doctrine-project.org/projects/dbal.html",
+ "keywords": [
+ "abstraction",
+ "database",
+ "dbal",
+ "mysql",
+ "persistence",
+ "pgsql",
+ "php",
+ "queryobject"
+ ],
+ "time": "2018-12-31T03:27:51+00:00"
+ },
+ {
+ "name": "doctrine/event-manager",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/event-manager.git",
+ "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3",
+ "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "conflict": {
+ "doctrine/common": "<2.9@dev"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^4.0",
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Common\\": "lib/Doctrine/Common"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ },
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com"
+ }
+ ],
+ "description": "Doctrine Event Manager component",
+ "homepage": "https://www.doctrine-project.org/projects/event-manager.html",
+ "keywords": [
+ "event",
+ "eventdispatcher",
+ "eventmanager"
+ ],
+ "time": "2018-06-11T11:59:03+00:00"
+ },
{
"name": "doctrine/inflector",
"version": "v1.3.0",
diff --git a/database/migrations/2019_01_13_224305_change_link_on_ejaculations.php b/database/migrations/2019_01_13_224305_change_link_on_ejaculations.php
new file mode 100644
index 0000000..a138c61
--- /dev/null
+++ b/database/migrations/2019_01_13_224305_change_link_on_ejaculations.php
@@ -0,0 +1,32 @@
+text('link')->default('')->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('ejaculations', function (Blueprint $table) {
+ $table->string('link')->default('')->change();
+ });
+ }
+}
diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php
index 7185719..924a213 100644
--- a/resources/views/layouts/base.blade.php
+++ b/resources/views/layouts/base.blade.php
@@ -65,7 +65,12 @@