diff options
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/application.properties | 3 | ||||
-rw-r--r-- | src/main/resources/data-h2.sql | 1 | ||||
-rw-r--r-- | src/main/resources/db/migration/V1.50__email_created_at.sql | 1 | ||||
-rw-r--r-- | src/main/resources/db/migration/V1.51__cast_users_lang.sql | 2 | ||||
-rw-r--r-- | src/main/resources/schema-h2.sql | 3 | ||||
-rw-r--r-- | src/main/resources/schema-mysql.sql | 1 | ||||
-rw-r--r-- | src/main/resources/schema-sqlite.sql | 1 | ||||
-rw-r--r-- | src/main/resources/schema-sqlserver.sql | 1 | ||||
-rw-r--r-- | src/main/resources/static/sw.js | 47 | ||||
-rw-r--r-- | src/main/resources/templates/layouts/default.html | 53 | ||||
-rw-r--r-- | src/main/resources/templates/views/thread.html | 2 |
11 files changed, 40 insertions, 75 deletions
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index fe206251..21c9f17a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,6 +7,9 @@ spring.jackson.serialization.write-dates-as-timestamps=false spring.jackson.serialization.write-empty-json-arrays=true spring.h2.console.enabled=false spring.datasource.generate-unique-name=false +spring.jpa.generate-ddl=false +spring.jpa.hibernate.ddl-auto=none +spring.jpa.open-in-view=false spring.flyway.enabled=false spring.sql.init.platform=h2 spring.cache.type=simple diff --git a/src/main/resources/data-h2.sql b/src/main/resources/data-h2.sql index 818575e9..72615485 100644 --- a/src/main/resources/data-h2.sql +++ b/src/main/resources/data-h2.sql @@ -1,6 +1,7 @@ INSERT INTO users(id, nick, passw) VALUES(0, 'Anonymous', 'password'); INSERT INTO users(id, nick, passw) VALUES(2, 'juick', 'password'); INSERT INTO users(id, nick, passw) VALUES(5, 'archive', 'password'); +INSERT INTO telegram(user_id, tg_id) VALUES(5, '1'); INSERT INTO reactions (like_id, description) VALUES (1, 'like'); INSERT INTO reactions (like_id, description) VALUES (2, 'love'); INSERT INTO reactions (like_id, description) VALUES (3, 'lol'); diff --git a/src/main/resources/db/migration/V1.50__email_created_at.sql b/src/main/resources/db/migration/V1.50__email_created_at.sql new file mode 100644 index 00000000..aa5b3f4b --- /dev/null +++ b/src/main/resources/db/migration/V1.50__email_created_at.sql @@ -0,0 +1 @@ +ALTER TABLE emails ADD COLUMN created_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP diff --git a/src/main/resources/db/migration/V1.51__cast_users_lang.sql b/src/main/resources/db/migration/V1.51__cast_users_lang.sql new file mode 100644 index 00000000..bb65a157 --- /dev/null +++ b/src/main/resources/db/migration/V1.51__cast_users_lang.sql @@ -0,0 +1,2 @@ +DROP CAST IF EXISTS (varchar AS public.users_lang); +CREATE CAST (varchar AS public.users_lang) WITH INOUT AS IMPLICIT; diff --git a/src/main/resources/schema-h2.sql b/src/main/resources/schema-h2.sql index 5fd7fff8..dc705727 100644 --- a/src/main/resources/schema-h2.sql +++ b/src/main/resources/schema-h2.sql @@ -233,7 +233,8 @@ ALTER TABLE "PUBLIC"."USERSINFO" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_BB6" PRIMAR CREATE MEMORY TABLE "PUBLIC"."EMAILS"( "USER_ID" INTEGER NOT NULL, "EMAIL" VARCHAR_IGNORECASE(255) NOT NULL, - "SUBSCR_HOUR" TINYINT DEFAULT NULL + "SUBSCR_HOUR" TINYINT DEFAULT NULL, + "CREATED_AT" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ); ALTER TABLE "PUBLIC"."EMAILS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_7A" PRIMARY KEY("EMAIL"); CREATE MEMORY TABLE "PUBLIC"."LOGINS"( diff --git a/src/main/resources/schema-mysql.sql b/src/main/resources/schema-mysql.sql index 0e035d5e..813b9e3d 100644 --- a/src/main/resources/schema-mysql.sql +++ b/src/main/resources/schema-mysql.sql @@ -72,6 +72,7 @@ CREATE TABLE `emails` ( `user_id` int(10) unsigned NOT NULL, `email` char(128) NOT NULL, `subscr_hour` tinyint(4) DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT current_timestamp(), KEY `email` (`email`) USING HASH ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/src/main/resources/schema-sqlite.sql b/src/main/resources/schema-sqlite.sql index 74ba28b6..54160c80 100644 --- a/src/main/resources/schema-sqlite.sql +++ b/src/main/resources/schema-sqlite.sql @@ -32,6 +32,7 @@ CREATE TABLE emails ( user_id INTEGER NOT NULL, email character varying(128) NOT NULL, subscr_hour smallint, + created_at DEFAULT (strftime('%s','now') || substr(strftime('%f','now'),4)) NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id) ); CREATE TABLE facebook ( diff --git a/src/main/resources/schema-sqlserver.sql b/src/main/resources/schema-sqlserver.sql index 947e5403..9ff21ed2 100644 --- a/src/main/resources/schema-sqlserver.sql +++ b/src/main/resources/schema-sqlserver.sql @@ -56,6 +56,7 @@ CREATE TABLE emails ( user_id bigint NOT NULL, email character varying(128) NOT NULL, subscr_hour smallint, + created_at datetimeoffset DEFAULT CURRENT_TIMESTAMP NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id) ); CREATE TABLE facebook ( diff --git a/src/main/resources/static/sw.js b/src/main/resources/static/sw.js deleted file mode 100644 index a64de7cc..00000000 --- a/src/main/resources/static/sw.js +++ /dev/null @@ -1,47 +0,0 @@ -/// <reference no-default-lib="true"/> -/// <reference lib="esnext" /> -/// <reference lib="WebWorker" /> - -var sw = /** @type {ServiceWorkerGlobalScope & typeof self} */ (self) -sw.addEventListener('install', function() { - sw.skipWaiting() -}) -sw.addEventListener('activate', function() { - sw.clients.claim() -}) -sw.addEventListener('push', function(evt) { - if (evt.data) { - const data = evt.data.json() - console.log('Push', data) - if (data.body) { - sw.registration.showNotification(data.title, { - body: data.body, - icon: data.custom.message.user.avatar, - tag: data.tag, - data: data.custom.message - }) - } - } -}) -sw.addEventListener('notificationclick', function(evt) { - evt.waitUntil( - sw.clients.matchAll().then(function(clientList) { - const message = evt.notification.data - const url = message.mid - ? message.rid - ? `https://juick.com/m/${message.mid}#${message.rid}` - : `https://juick.com/m/${message.mid}` - : 'https://juick.com/pm/inbox' - if (clientList.length > 0) { - for (var i = 0; i < clientList.length; i++) { - if (clientList[i].url === url) { - return clientList[i].focus() - } - } - clientList[0].navigate(url) - return clientList[0].focus() - } - return sw.clients.openWindow(url) - }) - ) -}) diff --git a/src/main/resources/templates/layouts/default.html b/src/main/resources/templates/layouts/default.html index 3b936e07..b7975b42 100644 --- a/src/main/resources/templates/layouts/default.html +++ b/src/main/resources/templates/layouts/default.html @@ -2,34 +2,34 @@ <html prefix="og: http://ogp.me/ns#"> <head> - <meta charset="utf-8" /> - <meta name="ermp-site-verification" value="6714D81C-9EEF-4283-A726-166680B6ABC8" /> + <meta charset="utf-8"> + <meta name="ermp-site-verification" value="6714D81C-9EEF-4283-A726-166680B6ABC8"> <script type="text/javascript" src="{{ beans.webApp.scriptsUrl }}"></script> - <link rel="stylesheet" type="text/css" href="{{ beans.webApp.styleUrl }}" /> + <link rel="stylesheet" type="text/css" href="{{ beans.webApp.styleUrl }}"> {% block headers %} {{ headers | default('') | raw }} {% endblock %} <title>{{ title | default('Juick') }}</title> - <meta property="og:type" content="{{ ogtype | default('website') }}" /> - <meta property="fb:app_id" content="130568668304" /> - <meta property="fb:pages" content="270127573154958" /> - <meta name="viewport" content="width=device-width,initial-scale=1" /> - <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" /> - <meta name="theme-color" content="#383838" media="(prefers-color-scheme: dark)" /> - <meta name="apple-mobile-web-app-capable" content="yes" /> - <link rel="apple-touch-icon" sizes="57x57" href="//i.juick.com/apple-icon-57x57.png" /> - <link rel="apple-touch-icon" sizes="60x60" href="//i.juick.com/apple-icon-60x60.png" /> - <link rel="apple-touch-icon" sizes="72x72" href="//i.juick.com/apple-icon-72x72.png" /> - <link rel="apple-touch-icon" sizes="76x76" href="//i.juick.com/apple-icon-76x76.png" /> - <link rel="apple-touch-icon" sizes="114x114" href="//i.juick.com/apple-icon-114x114.png" /> - <link rel="apple-touch-icon" sizes="120x120" href="//i.juick.com/apple-icon-120x120.png" /> - <link rel="apple-touch-icon" sizes="144x144" href="//i.juick.com/apple-icon-144x144.png" /> - <link rel="apple-touch-icon" sizes="152x152" href="//i.juick.com/apple-icon-152x152.png" /> - <link rel="apple-touch-icon" sizes="180x180" href="//i.juick.com/apple-icon-180x180.png" /> - <link rel="icon" type="image/png" sizes="32x32" href="//i.juick.com/favicon-32x32.png" /> - <link rel="icon" type="image/png" sizes="96x96" href="//i.juick.com/favicon-96x96.png" /> - <link rel="icon" type="image/png" sizes="16x16" href="//i.juick.com/favicon-16x16.png" /> - <link rel="manifest" href="//i.juick.com/manifest.json" /> + <meta property="og:type" content="{{ ogtype | default('website') }}"> + <meta property="fb:app_id" content="130568668304"> + <meta property="fb:pages" content="270127573154958"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)"> + <meta name="theme-color" content="#383838" media="(prefers-color-scheme: dark)"> + <meta name="web-app-capable" content="yes"> + <link rel="apple-touch-icon" sizes="57x57" href="//i.juick.com/apple-icon-57x57.png"> + <link rel="apple-touch-icon" sizes="60x60" href="//i.juick.com/apple-icon-60x60.png"> + <link rel="apple-touch-icon" sizes="72x72" href="//i.juick.com/apple-icon-72x72.png"> + <link rel="apple-touch-icon" sizes="76x76" href="//i.juick.com/apple-icon-76x76.png"> + <link rel="apple-touch-icon" sizes="114x114" href="//i.juick.com/apple-icon-114x114.png"> + <link rel="apple-touch-icon" sizes="120x120" href="//i.juick.com/apple-icon-120x120.png"> + <link rel="apple-touch-icon" sizes="144x144" href="//i.juick.com/apple-icon-144x144.png"> + <link rel="apple-touch-icon" sizes="152x152" href="//i.juick.com/apple-icon-152x152.png"> + <link rel="apple-touch-icon" sizes="180x180" href="//i.juick.com/apple-icon-180x180.png"> + <link rel="icon" type="image/png" sizes="32x32" href="//i.juick.com/favicon-32x32.png"> + <link rel="icon" type="image/png" sizes="96x96" href="//i.juick.com/favicon-96x96.png"> + <link rel="icon" type="image/png" sizes="16x16" href="//i.juick.com/favicon-16x16.png"> + <link rel="manifest" href="//i.juick.com/juick.webmanifest"> </head> <body id="body"> @@ -38,12 +38,13 @@ <div id="content_wrapper"> <aside id="column"> <div id="sidebar_wrapper"> - {% block column %} - {% endblock %} + {% block column %} + {% endblock %} </div> </aside> {% flush %} - <section id="content" {% if msg | default('') is not empty %}data-mid="{{ msg.mid }}" {% endif %} class="content--top"> + <section id="content" {% if msg | default('') is not empty %}data-mid="{{ msg.mid }}" {% endif %} + class="content--top"> {% block content %} {% endblock %} </section> diff --git a/src/main/resources/templates/views/thread.html b/src/main/resources/templates/views/thread.html index 9aad1ce5..ab751294 100644 --- a/src/main/resources/templates/views/thread.html +++ b/src/main/resources/templates/views/thread.html @@ -116,7 +116,7 @@ {% if rec.uri.toString() is empty %} <a href="/{{ rec.name }}/">@{{ rec.name }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} {% else %} - <a href="{{ rec.uri }}">@{{ rec.name }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} + <a href="{{ rec.uri }}">@{{ rec.name }}<span class="dimmed">@{{ rec.uri.host }}</span></a>{% if loop.index < (loop.length - 1) %}, {% endif %} {% endif %} {% endfor %} </div> |