diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql
index f49be87..cc468cb 100644
--- a/db/app_uoj233.sql
+++ b/db/app_uoj233.sql
@@ -815,6 +815,7 @@ CREATE TABLE `user_info` (
`motto` varchar(200) NOT NULL,
`last_login` timestamp NOT NULL DEFAULT 0,
`last_visited` timestamp NOT NULL DEFAULT 0,
+ `images_size_limit` int(11) UNSIGNED NOT NULL DEFAULT 104857600, /* 100 MiB */
PRIMARY KEY (`username`),
KEY `ac_num` (`ac_num`,`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
@@ -829,6 +830,35 @@ LOCK TABLES `user_info` WRITE;
/*!40000 ALTER TABLE `user_info` ENABLE KEYS */;
UNLOCK TABLES;
+--
+-- Table structure for table `users_images`
+--
+
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8mb4 */;
+CREATE TABLE `users_images` (
+ `id` varchar(30) NOT NULL,
+ `username` varchar(20) NOT NULL,
+ `width` int(11) NOT NULL,
+ `height` int(11) NOT NULL,
+ `upload_time` datetime NOT NULL,
+ `size` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `username` (`username`),
+ KEY `upload_time` (`upload_time`),
+ KEY `size` (`size`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `users_images`
+--
+
+LOCK TABLES `users_images` WRITE;
+/*!40000 ALTER TABLE `users_images` DISABLE KEYS */;
+/*!40000 ALTER TABLE `users_images` ENABLE KEYS */;
+UNLOCK TABLES;
+
--
-- Table structure for table `user_msg`
--
diff --git a/web/app/controllers/image_hosting/get_image.php b/web/app/controllers/image_hosting/get_image.php
new file mode 100644
index 0000000..e6e8fae
--- /dev/null
+++ b/web/app/controllers/image_hosting/get_image.php
@@ -0,0 +1,6 @@
+
+
+
+
+
+ = UOJLocale::get('image hosting') ?>
+
+
+
diff --git a/web/app/locale/basic/en.php b/web/app/locale/basic/en.php
index 44fd378..cb2bcd2 100644
--- a/web/app/locale/basic/en.php
+++ b/web/app/locale/basic/en.php
@@ -100,4 +100,6 @@ return [
'last active at' => 'Last active at',
'online' => 'Online',
'offline' => 'Offline',
+ 'apps' => 'Apps',
+ 'image hosting' => 'Image Hosting',
];
diff --git a/web/app/locale/basic/zh-cn.php b/web/app/locale/basic/zh-cn.php
index 133eeba..135b050 100644
--- a/web/app/locale/basic/zh-cn.php
+++ b/web/app/locale/basic/zh-cn.php
@@ -100,4 +100,6 @@ return [
'online' => '在线',
'offline' => '离线',
'last active at' => '最后活动于',
+ 'apps' => '应用',
+ 'image hosting' => '图床',
];
diff --git a/web/app/route.php b/web/app/route.php
index 3ea089e..3b89394 100644
--- a/web/app/route.php
+++ b/web/app/route.php
@@ -5,6 +5,7 @@ Route::pattern('id', '[1-9][0-9]{0,9}');
Route::pattern('contest_id', '[1-9][0-9]{0,9}');
Route::pattern('tab', '\S{1,20}');
Route::pattern('rand_str_id', '[0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]{20}');
+Route::pattern('image_name', '[0123456789abcdefghijklmnopqrstuvwxyz]{7}');
Route::pattern('upgrade_name', '[a-zA-Z0-9_]{1,50}');
Route::group([
@@ -78,6 +79,10 @@ Route::group([
Route::any('/download.php', '/download.php');
Route::any('/click-zan', '/click_zan.php');
+
+ // Image Hosting
+ Route::any('/image-hosting', '/image_hosting/index.php');
+ Route::get('/image-hosting/{image_name}.png', '/image_hosting/get_image.php');
}
);
diff --git a/web/app/storage/image_hosting/.gitkeep b/web/app/storage/image_hosting/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/web/app/upgrade/4_image_hosting/README.md b/web/app/upgrade/4_image_hosting/README.md
new file mode 100644
index 0000000..a936858
--- /dev/null
+++ b/web/app/upgrade/4_image_hosting/README.md
@@ -0,0 +1 @@
+ref: https://github.com/renbaoshuo/S2OJ/issues/4
diff --git a/web/app/upgrade/4_image_hosting/down.sql b/web/app/upgrade/4_image_hosting/down.sql
new file mode 100644
index 0000000..422652d
--- /dev/null
+++ b/web/app/upgrade/4_image_hosting/down.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `user_info` DROP COLUMN IF EXISTS `images_size_limit`;
+DROP TABLE IF EXISTS `users_images`;
diff --git a/web/app/upgrade/4_image_hosting/up.sql b/web/app/upgrade/4_image_hosting/up.sql
new file mode 100644
index 0000000..5a64bd1
--- /dev/null
+++ b/web/app/upgrade/4_image_hosting/up.sql
@@ -0,0 +1,21 @@
+ALTER TABLE `user_info` ADD COLUMN `images_size_limit` int(11) UNSIGNED NOT NULL DEFAULT 104857600 /* 100 MiB */;
+
+--
+-- Table structure for table `users_images`
+--
+
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8mb4 */;
+CREATE TABLE IF NOT EXISTS `users_images` (
+ `id` varchar(30) NOT NULL,
+ `username` varchar(20) NOT NULL,
+ `width` int(11) NOT NULL,
+ `height` int(11) NOT NULL,
+ `upload_time` datetime NOT NULL,
+ `size` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `username` (`username`),
+ KEY `upload_time` (`upload_time`),
+ KEY `size` (`size`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
+/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/web/app/views/main-nav.php b/web/app/views/main-nav.php
index eb6cc71..0ad8496 100644
--- a/web/app/views/main-nav.php
+++ b/web/app/views/main-nav.php
@@ -103,6 +103,22 @@ mb-4" role="navigation">
= UOJLocale::get('blogs') ?>
+
+
+
+
+ = UOJLocale::get('apps') ?>
+
+
+
+
diff --git a/web/install.sh b/web/install.sh
index e86112f..c385272 100644
--- a/web/install.sh
+++ b/web/install.sh
@@ -89,6 +89,7 @@ initProgress(){
service apache2 restart
mkdir -p /opt/uoj/web/app/storage/submission
mkdir -p /opt/uoj/web/app/storage/tmp
+ mkdir -p /opt/uoj/web/app/storage/image_hosting
chmod -R 777 /opt/uoj/web/app/storage
#Using cli upgrade to latest
php7.4 /var/www/uoj/app/cli.php upgrade:latest