aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/cliqset/xrd/Alias.java63
-rw-r--r--src/main/java/com/cliqset/xrd/Expires.java58
-rw-r--r--src/main/java/com/cliqset/xrd/Link.java151
-rw-r--r--src/main/java/com/cliqset/xrd/Property.java75
-rw-r--r--src/main/java/com/cliqset/xrd/Signature.java21
-rw-r--r--src/main/java/com/cliqset/xrd/Subject.java62
-rw-r--r--src/main/java/com/cliqset/xrd/Title.java68
-rw-r--r--src/main/java/com/cliqset/xrd/XRD.java166
-rw-r--r--src/main/java/com/cliqset/xrd/XRDConstants.java26
-rw-r--r--src/main/java/com/cliqset/xrd/XRDException.java35
-rw-r--r--src/main/java/com/cliqset/xrd/package-info.java33
-rw-r--r--src/main/java/com/juick/EmailManager.java3
-rw-r--r--src/main/java/com/juick/config/AppConfig.java9
-rw-r--r--src/main/java/com/juick/config/HttpClientConfig.java1
-rw-r--r--src/main/java/com/juick/config/SecurityConfig.java1
-rw-r--r--src/main/java/com/juick/model/User.java9
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java2
-rw-r--r--src/main/java/com/juick/service/TagServiceImpl.java3
-rw-r--r--src/main/java/com/juick/service/UserService.java3
-rw-r--r--src/main/java/com/juick/service/UserServiceImpl.java39
-rw-r--r--src/main/java/com/juick/util/MessageUtils.java21
-rw-r--r--src/main/java/com/juick/util/xmpp/JidConverter.java3
-rw-r--r--src/main/java/com/juick/www/api/Mastodon.java2
-rw-r--r--src/main/java/com/juick/www/api/hostmeta/HostMeta.java43
-rw-r--r--src/main/java/com/juick/www/api/webfinger/Resource.java47
-rw-r--r--src/main/java/com/juick/www/api/xnodeinfo2/Info.java25
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java2
-rw-r--r--src/main/resources/db/migration/V1.50__email_created_at.sql1
-rw-r--r--src/main/resources/db/migration/V1.51__cast_users_lang.sql2
-rw-r--r--src/main/resources/schema-h2.sql3
-rw-r--r--src/main/resources/schema-mysql.sql1
-rw-r--r--src/main/resources/schema-sqlite.sql1
-rw-r--r--src/main/resources/schema-sqlserver.sql1
-rw-r--r--src/main/resources/templates/layouts/default.html53
34 files changed, 85 insertions, 948 deletions
diff --git a/src/main/java/com/cliqset/xrd/Alias.java b/src/main/java/com/cliqset/xrd/Alias.java
deleted file mode 100644
index 3a108f46..00000000
--- a/src/main/java/com/cliqset/xrd/Alias.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAnyAttribute;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.XmlValue;
-
-@XmlType(name="Alias", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Alias {
-
- @XmlAnyAttribute()
- private Map<QName, Object> unknownAttributes;
-
- @XmlValue
- private URI value;
-
- public void setValue(URI value) {
- this.value = value;
- }
-
- public URI getValue() {
- return value;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/Expires.java b/src/main/java/com/cliqset/xrd/Expires.java
deleted file mode 100644
index bb6704f8..00000000
--- a/src/main/java/com/cliqset/xrd/Expires.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import jakarta.xml.bind.annotation.*;
-
-@XmlType(name="Expires", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Expires {
-
- @XmlAnyAttribute
- private Map<QName, Object> unknownAttributes;
-
- @XmlValue
- private Date value;
-
- public void setValue(Date value) {
- this.value = value;
- }
-
- public Date getValue() {
- return value;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/Link.java b/src/main/java/com/cliqset/xrd/Link.java
deleted file mode 100644
index 020defe6..00000000
--- a/src/main/java/com/cliqset/xrd/Link.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import jakarta.xml.bind.annotation.XmlAnyElement;
-import jakarta.xml.bind.annotation.XmlAnyAttribute;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlElement;
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-
-import org.w3c.dom.Element;
-
-@XmlType(name="Link", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Link {
-
- @XmlAttribute(name="rel")
- private URI rel;
-
- @XmlAttribute(name="type")
- private String type;
-
- @XmlAttribute(name="href")
- private URI href;
-
- @XmlAttribute(name="template")
- private String template;
-
- @XmlElement(name="Title")
- private List<Title> titles;
-
- @XmlElement(name="Property")
- private List<Property> properties;
-
- @XmlAnyElement
- private List<Element> unknownElements;
-
- @XmlAnyAttribute
- private Map<QName,Object> unknownAttributes;
-
- private URI processedTemplate;
-
- public void setRel(URI rel) {
- this.rel = rel;
- }
-
- public URI getRel() {
- return rel;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public void setHref(URI href) {
- this.href = href;
- }
-
- public URI getHref() {
- return href;
- }
-
- public void setTemplate(String template) {
- this.template = template;
- }
-
- public String getTemplate() {
- return template;
- }
-
- public void setTitles(List<Title> titles) {
- this.titles = titles;
- }
-
- public List<Title> getTitles() {
- return titles;
- }
-
- public void setProperties(List<Property> properties) {
- this.properties = properties;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public void setUnknownElements(List<Element> unknownElements) {
- this.unknownElements = unknownElements;
- }
-
- public List<Element> getUnknownElements() {
- return unknownElements;
- }
-
- public void setUnknownAttributes(Map<QName,Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName,Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasTemplate() {
- return null != this.template;
- }
-
- public boolean hasHref() {
- return null != this.href;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-
- public void setProcessedTemplate(URI processedTemplate) {
- this.processedTemplate = processedTemplate;
- }
-
- public URI getProcessedTemplate() {
- return processedTemplate;
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/Property.java b/src/main/java/com/cliqset/xrd/Property.java
deleted file mode 100644
index f7777c94..00000000
--- a/src/main/java/com/cliqset/xrd/Property.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import java.net.URI;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAnyAttribute;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.XmlValue;
-import javax.xml.namespace.QName;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@XmlType(name="Property", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Property {
-
- @XmlAttribute(name="type", required=true)
- private URI type;
-
- @XmlAnyAttribute()
- private Map<QName, Object> unknownAttributes;
-
- @XmlValue()
- private URI value;
-
- public void setType(URI type) {
- this.type = type;
- }
-
- public URI getType() {
- return type;
- }
-
- public void setValue(URI value) {
- this.value = value;
- }
-
- public URI getValue() {
- return value;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/Signature.java b/src/main/java/com/cliqset/xrd/Signature.java
deleted file mode 100644
index f52f9218..00000000
--- a/src/main/java/com/cliqset/xrd/Signature.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-public class Signature {
-
-}
diff --git a/src/main/java/com/cliqset/xrd/Subject.java b/src/main/java/com/cliqset/xrd/Subject.java
deleted file mode 100644
index d2f6b333..00000000
--- a/src/main/java/com/cliqset/xrd/Subject.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAnyAttribute;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.XmlValue;
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-@XmlType(name="Subject", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Subject {
-
- @XmlAnyAttribute()
- private Map<QName, Object> unknownAttributes;
-
- @XmlValue
- private URI value;
-
- public void setValue(URI value) {
- this.value = value;
- }
-
- public URI getValue() {
- return value;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/Title.java b/src/main/java/com/cliqset/xrd/Title.java
deleted file mode 100644
index 4bb43c55..00000000
--- a/src/main/java/com/cliqset/xrd/Title.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import jakarta.xml.bind.annotation.*;
-import javax.xml.namespace.QName;
-
-@XmlType(name="Title", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class Title {
-
- @XmlAttribute(name="lang", namespace=XRDConstants.XML_NAMESPACE)
- private String lang;
-
- @XmlAnyAttribute()
- private Map<QName, Object> unknownAttributes;
-
- @XmlValue
- private String value;
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
- public String getLang() {
- return lang;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- if (null == this.unknownAttributes) {
- this.unknownAttributes = new HashMap<QName, Object>();
- }
- return unknownAttributes;
- }
-
- public boolean hasUnknownAttributes() {
- return !(null == this.unknownAttributes || this.unknownAttributes.size() < 1);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/XRD.java b/src/main/java/com/cliqset/xrd/XRD.java
deleted file mode 100644
index 8fc6f7de..00000000
--- a/src/main/java/com/cliqset/xrd/XRD.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-import javax.xml.namespace.QName;
-import jakarta.xml.bind.annotation.*;
-import jakarta.xml.bind.JAXBContext;
-import jakarta.xml.bind.JAXBException;
-
-import org.w3c.dom.Element;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
-@XmlRootElement(name="XRD", namespace=XRDConstants.XRD_NAMESPACE)
-@XmlAccessorType(XmlAccessType.FIELD)
-public class XRD {
-
- @XmlAttribute(name="id", namespace=XRDConstants.XML_NAMESPACE)
- private String id;
-
- @XmlAnyAttribute
- private Map<QName, Object> unknownAttributes;
-
- @XmlElement(name="Expires", namespace=XRDConstants.XRD_NAMESPACE)
- private Expires expires;
-
- @XmlElement(name="Subject", namespace=XRDConstants.XRD_NAMESPACE)
- private Subject subject;
-
- @XmlElement(name="Alias", namespace=XRDConstants.XRD_NAMESPACE)
- private List<Alias> aliases;
-
- @XmlElement(name="Property", namespace=XRDConstants.XRD_NAMESPACE)
- private List<Property> properties;
-
- @XmlElement(name="Link", namespace=XRDConstants.XRD_NAMESPACE)
- private List<Link> links;
-
- @XmlElement(name="Signature", namespace=XRDConstants.XML_SIG_NAMESPACE)
- private List<Signature> signatures;
-
- @XmlAnyElement
- private List<Element> unknownElements;
-
- public void setExpires(Expires expires) {
- this.expires = expires;
- }
-
- public Expires getExpires() {
- return expires;
- }
-
- public void setSubject(Subject subject) {
- this.subject = subject;
- }
-
- public Subject getSubject() {
- return subject;
- }
-
- public void setAliases(List<Alias> aliases) {
- this.aliases = aliases;
- }
-
- public List<Alias> getAliases() {
- return aliases;
- }
-
- public void setProperties(List<Property> properties) {
- this.properties = properties;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public void setLinks(List<Link> links) {
- this.links = links;
- }
-
- public List<Link> getLinks() {
- return links;
- }
-
- public void setSignatures(List<Signature> signatures) {
- this.signatures = signatures;
- }
-
- public List<Signature> getSignatures() {
- return signatures;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public void setUnknownAttributes(Map<QName, Object> unknownAttributes) {
- this.unknownAttributes = unknownAttributes;
- }
-
- public Map<QName, Object> getUnknownAttributes() {
- return unknownAttributes;
- }
-
- public void setUnknownElements(List<Element> unknownElements) {
- this.unknownElements = unknownElements;
- }
-
- public List<Element> getUnknownElements() {
- return unknownElements;
- }
-
- public boolean hasId() {
- return null != this.id;
- }
-
- public boolean hasExpires() {
- return null != this.expires;
- }
-
- public boolean hasSubject() {
- return null != this.subject;
- }
-
- public boolean hasAliases() {
- return null != this.aliases;
- }
-
- public boolean hasProperties() {
- return null != this.properties;
- }
-
- public boolean hasLinks() {
- return null != this.links;
- }
-
- public static XRD fromStream(InputStream stream) throws XRDException {
- JAXBContext context;
- try {
- context = JAXBContext.newInstance(XRD.class);
- return (XRD)context.createUnmarshaller().unmarshal(stream);
- } catch (JAXBException e) {
- throw new XRDException("Unable to deserialize stream into XRD", e);
- }
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/XRDConstants.java b/src/main/java/com/cliqset/xrd/XRDConstants.java
deleted file mode 100644
index 39e3c584..00000000
--- a/src/main/java/com/cliqset/xrd/XRDConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-public class XRDConstants {
-
- public static final String XRD_NAMESPACE = "http://docs.oasis-open.org/ns/xri/xrd-1.0";
- public static final String XML_SIG_NAMESPACE = "";
- public static final String XML_NAMESPACE = "";
-
- public static final String XRD_MEDIA_TYPE = "application/xrd+xml";
-}
diff --git a/src/main/java/com/cliqset/xrd/XRDException.java b/src/main/java/com/cliqset/xrd/XRDException.java
deleted file mode 100644
index da1e6849..00000000
--- a/src/main/java/com/cliqset/xrd/XRDException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright 2010 Cliqset Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package com.cliqset.xrd;
-
-@SuppressWarnings("serial")
-public class XRDException extends Exception {
-
- public XRDException() {}
-
- public XRDException(String message) {
- super(message);
- }
-
- public XRDException(Throwable cause) {
- super(cause);
- }
-
- public XRDException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/src/main/java/com/cliqset/xrd/package-info.java b/src/main/java/com/cliqset/xrd/package-info.java
deleted file mode 100644
index dfc11f51..00000000
--- a/src/main/java/com/cliqset/xrd/package-info.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2008-2017, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-@XmlSchema(
- namespace=XRD_NAMESPACE,
- elementFormDefault = XmlNsForm.QUALIFIED,
- xmlns={
- @XmlNs(prefix= StringUtils.EMPTY, namespaceURI=XRD_NAMESPACE)
- }
-)
-package com.cliqset.xrd;
-
-import org.apache.commons.lang3.StringUtils;
-
-import jakarta.xml.bind.annotation.XmlNs;
-import jakarta.xml.bind.annotation.XmlNsForm;
-import jakarta.xml.bind.annotation.XmlSchema;
-
-import static com.cliqset.xrd.XRDConstants.XRD_NAMESPACE; \ No newline at end of file
diff --git a/src/main/java/com/juick/EmailManager.java b/src/main/java/com/juick/EmailManager.java
index df02fe1c..37c8e3c5 100644
--- a/src/main/java/com/juick/EmailManager.java
+++ b/src/main/java/com/juick/EmailManager.java
@@ -33,7 +33,6 @@ import jakarta.mail.internet.MimeMessage;
import jakarta.mail.internet.MimeMultipart;
import com.juick.util.HttpBadRequestException;
-import com.juick.www.WebApp;
import com.juick.service.EmailService;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
@@ -67,8 +66,6 @@ public class EmailManager implements NotificationListener {
private UserService userService;
@Inject
private ObjectMapper jsonMapper;
- @Inject
- private WebApp webApp;
@Value("${web_domain:localhost}")
private String webDomain;
@Value("${service_email:}")
diff --git a/src/main/java/com/juick/config/AppConfig.java b/src/main/java/com/juick/config/AppConfig.java
index 32cc5899..a48c7ee0 100644
--- a/src/main/java/com/juick/config/AppConfig.java
+++ b/src/main/java/com/juick/config/AppConfig.java
@@ -20,15 +20,8 @@ package com.juick.config;
import com.juick.*;
import com.juick.model.User;
import com.juick.service.*;
-import com.mitchellbosecke.pebble.extension.FormatterExtension;
import com.overzealous.remark.Options;
import com.overzealous.remark.Remark;
-import io.pebbletemplates.pebble.PebbleEngine;
-import io.pebbletemplates.pebble.loader.ClasspathLoader;
-import io.pebbletemplates.pebble.loader.Loader;
-import io.pebbletemplates.spring.extension.SpringExtension;
-import io.pebbletemplates.spring.servlet.PebbleViewResolver;
-
import org.commonmark.ext.autolink.AutolinkExtension;
import org.commonmark.node.Link;
import org.commonmark.parser.Parser;
@@ -40,11 +33,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.security.web.firewall.HttpStatusRequestRejectedHandler;
import org.springframework.security.web.firewall.RequestRejectedHandler;
-import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
import org.springframework.web.servlet.resource.ResourceUrlProvider;
-import java.nio.charset.StandardCharsets;
import java.util.Collections;
import jakarta.inject.Inject;
diff --git a/src/main/java/com/juick/config/HttpClientConfig.java b/src/main/java/com/juick/config/HttpClientConfig.java
index 9f5182e8..fd94ae4f 100644
--- a/src/main/java/com/juick/config/HttpClientConfig.java
+++ b/src/main/java/com/juick/config/HttpClientConfig.java
@@ -18,7 +18,6 @@
package com.juick.config;
import com.juick.util.ActivityPubRequestInterceptor;
-import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import org.slf4j.Logger;
diff --git a/src/main/java/com/juick/config/SecurityConfig.java b/src/main/java/com/juick/config/SecurityConfig.java
index 6e9afa42..a93a4a5c 100644
--- a/src/main/java/com/juick/config/SecurityConfig.java
+++ b/src/main/java/com/juick/config/SecurityConfig.java
@@ -206,7 +206,6 @@ public class SecurityConfig {
"/api/inbox", "/api/events", "/api/u/", "/u/**",
"/n/**",
"/api/info/**", "/api/v1/apps", "/api/v1/instance",
- "/api/v2/instance",
"/api/nodeinfo/2.0", "/oauth/**")
.permitAll()
.anyRequest().hasAnyAuthority("SCOPE_write", "ROLE_USER"))
diff --git a/src/main/java/com/juick/model/User.java b/src/main/java/com/juick/model/User.java
index 7b0b7099..dd0feda1 100644
--- a/src/main/java/com/juick/model/User.java
+++ b/src/main/java/com/juick/model/User.java
@@ -64,6 +64,7 @@ public class User implements Serializable {
private boolean premium;
@XmlTransient
private boolean admin;
+ private String language;
public User() {
tokens = new ArrayList<>();
@@ -298,4 +299,12 @@ public class User implements Serializable {
public void setAdmin(boolean admin) {
this.admin = admin;
}
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
}
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index bad080a0..de342977 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -38,8 +38,6 @@ import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
-import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
-import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/main/java/com/juick/service/TagServiceImpl.java b/src/main/java/com/juick/service/TagServiceImpl.java
index 9f5c9356..1eea6812 100644
--- a/src/main/java/com/juick/service/TagServiceImpl.java
+++ b/src/main/java/com/juick/service/TagServiceImpl.java
@@ -27,15 +27,12 @@ import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.support.GeneratedKeyHolder;
-import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java
index 3c7a3235..845028f7 100644
--- a/src/main/java/com/juick/service/UserService.java
+++ b/src/main/java/com/juick/service/UserService.java
@@ -32,7 +32,6 @@ import org.springframework.cache.annotation.Cacheable;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
/**
@@ -83,6 +82,8 @@ public interface UserService {
boolean updateUserInfo(User info);
+ boolean updateLanguage(User user);
+
boolean isInWL(int uid, int check);
boolean isInBL(int uid, int check);
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java
index a5ab8432..bad1378a 100644
--- a/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/src/main/java/com/juick/service/UserServiceImpl.java
@@ -27,20 +27,13 @@ import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.UncategorizedSQLException;
-import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
-import org.springframework.jdbc.support.GeneratedKeyHolder;
-import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.StackWalker.Option;
import java.net.URI;
import java.sql.*;
import java.time.Instant;
@@ -72,6 +65,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
user.setVerified(rs.getLong(6) > 0);
user.setPremium(rs.getInt(7) > 0);
user.setAdmin(adminUsers.contains(user.getName()));
+ user.setLanguage(rs.getString("lang"));
return user;
}
}
@@ -126,7 +120,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
public Optional<User> getUserByUID(final int uid) {
var list = getJdbcTemplate().query("""
SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen,
- COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium
+ COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang
FROM users u LEFT JOIN facebook f ON f.user_id = u.id
LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id
LEFT JOIN emails e ON e.user_id = u.id WHERE u.id = ?""", userMapper, uid);
@@ -140,7 +134,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
if (StringUtils.isNotBlank(username)) {
var list = getJdbcTemplate().query("""
SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen,
- COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium
+ COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang
FROM users u LEFT JOIN facebook f ON f.user_id = u.id
LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id
LEFT JOIN emails e ON e.user_id = u.id
@@ -165,7 +159,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
try {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, " +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id " +
@@ -191,7 +185,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
if (StringUtils.isNotBlank(jid)) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen," +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id " +
@@ -213,7 +207,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
return getNamedParameterJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen," +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id " +
@@ -230,7 +224,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
return getNamedParameterJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen," +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id " +
@@ -265,7 +259,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
if (StringUtils.isNotBlank(hash)) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT logins.user_id, u.nick, u.passw, u.banned, u.last_seen," +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM logins INNER JOIN users u ON logins.user_id = u.id " +
"LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
@@ -303,7 +297,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
if (StringUtils.isNotBlank(username)) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen," +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id " +
@@ -369,6 +363,15 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
}
}
+ @Transactional
+ @Override
+ public boolean updateLanguage(final User user) {
+ return getJdbcTemplate().update(
+ "UPDATE users SET lang=? WHERE id=?",
+ user.getLanguage(),
+ user.getUid()) > 0;
+ }
+
@Transactional(readOnly = true)
@Override
public boolean isInWL(final int uid, final int check) {
@@ -759,7 +762,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
List<User> list = getJdbcTemplate().query(
"""
SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen,
- COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium
+ COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang
FROM users u LEFT JOIN facebook f ON f.user_id = u.id
LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id
LEFT JOIN emails e ON e.user_id = u.id
@@ -792,7 +795,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
public Optional<User> getUserByFacebookId(long facebookId) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, " +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id WHERE f.fb_id = ?", new UserMapper(), facebookId);
@@ -819,7 +822,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
public Optional<User> getUserByVKID(long vkID) {
List<User> list = getJdbcTemplate().query(
"SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, " +
- "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium " +
+ "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified, premium, lang " +
"FROM users u LEFT JOIN facebook f ON f.user_id = u.id " +
"LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " +
"LEFT JOIN emails e ON e.user_id = u.id WHERE vk.vk_id = ?", new UserMapper(), vkID);
diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java
index 316adb90..5418ae64 100644
--- a/src/main/java/com/juick/util/MessageUtils.java
+++ b/src/main/java/com/juick/util/MessageUtils.java
@@ -42,13 +42,20 @@ public class MessageUtils {
}
public static String formatQuote(final String quote) {
+ return formatQuote(quote, false);
+ }
+
+ public static String formatQuote(final String quote, final boolean isHtml) {
String result = quote;
+ var prefix = isHtml ? "<blockquote>" : ">";
+ var suffix = isHtml ? "</blockquote>" : "\n";
+
if (quote != null) {
if (quote.length() > 50) {
- result = ">" + StringUtils.abbreviate(quote, "…", 47).replace('\n', ' ') + "\n";
+ result = prefix + StringUtils.abbreviate(quote, "…", 47).replace('\n', ' ') + suffix;
} else if (!quote.isEmpty()) {
- result = ">" + quote.replace('\n', ' ') + "\n";
+ result = prefix + quote.replace('\n', ' ') + suffix;
}
}
@@ -57,7 +64,7 @@ public class MessageUtils {
private final static String urlWhiteSpacePrefix = "((?<=\\s)|(?<=\\A))";
- private final static String urlRegex = "((?:(?:ht|f)tps?://(?:www\\.)?([^\\s()<>/?#]+)([^\\s()<>]*)?))";
+ private final static String urlRegex = "((?:(?:ht|f)tps?://(?:www\\.)?([^\\s()<>/?#]+)([^\\s()<>«»]*)?))";
private final static String urlWithWhitespacesRegex =
urlWhiteSpacePrefix + urlRegex;
@@ -220,11 +227,11 @@ public class MessageUtils {
m.appendTail(sb);
msg = sb.toString();
+
+ // > citate
+ msg = msg.replaceAll(citateRegex, "<blockquote>$1</blockquote>");
+ msg = msg.replaceAll("</blockquote><blockquote>", "\n");
if (!compatibleWithDurov) {
- // > citate
- msg = msg.replaceAll(citateRegex, "<blockquote>$1</blockquote>");
- msg = msg.replaceAll("</blockquote><blockquote>", "\n");
-
msg = msg.replaceAll("\n", "<br/>\n");
}
return msg;
diff --git a/src/main/java/com/juick/util/xmpp/JidConverter.java b/src/main/java/com/juick/util/xmpp/JidConverter.java
index 4f457164..5c40d470 100644
--- a/src/main/java/com/juick/util/xmpp/JidConverter.java
+++ b/src/main/java/com/juick/util/xmpp/JidConverter.java
@@ -18,13 +18,14 @@
package com.juick.util.xmpp;
import org.springframework.core.convert.converter.Converter;
+import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import rocks.xmpp.addr.Jid;
public class JidConverter implements Converter<String, Jid> {
@Nullable
@Override
- public Jid convert(String jidStr) {
+ public Jid convert(@NonNull String jidStr) {
return Jid.of(jidStr);
}
}
diff --git a/src/main/java/com/juick/www/api/Mastodon.java b/src/main/java/com/juick/www/api/Mastodon.java
index 220963c1..ca3687e7 100644
--- a/src/main/java/com/juick/www/api/Mastodon.java
+++ b/src/main/java/com/juick/www/api/Mastodon.java
@@ -164,7 +164,7 @@ public class Mastodon {
) {
}
- @GetMapping({"/api/v1/instance", "/api/v2/instance"})
+ @GetMapping("/api/v1/instance")
public Instance getInstance() {
return new Instance(domain, "Microblogging service", "Juick", "2.x","support@juick.com");
}
diff --git a/src/main/java/com/juick/www/api/hostmeta/HostMeta.java b/src/main/java/com/juick/www/api/hostmeta/HostMeta.java
deleted file mode 100644
index c6f1dce6..00000000
--- a/src/main/java/com/juick/www/api/hostmeta/HostMeta.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2008-2020, Juick
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.juick.www.api.hostmeta;
-
-import com.cliqset.xrd.Link;
-import com.cliqset.xrd.XRD;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Collections;
-
-import static com.cliqset.xrd.XRDConstants.XRD_MEDIA_TYPE;
-
-@RestController
-public class HostMeta {
- @Value("${ap_base_uri:http://localhost:8080/}")
- private String baseUri;
- @GetMapping(value = "/.well-known/host-meta", produces = { XRD_MEDIA_TYPE, MediaType.APPLICATION_XML_VALUE })
- public XRD hostMetaResponse() {
- Link webfinger = new Link();
- webfinger.setTemplate(String.format("%swebfinger?resource={uri}", baseUri));
- XRD xrd = new XRD();
- xrd.setLinks(Collections.singletonList(webfinger));
- return xrd;
- }
-}
diff --git a/src/main/java/com/juick/www/api/webfinger/Resource.java b/src/main/java/com/juick/www/api/webfinger/Resource.java
index 1de205df..3f04097c 100644
--- a/src/main/java/com/juick/www/api/webfinger/Resource.java
+++ b/src/main/java/com/juick/www/api/webfinger/Resource.java
@@ -17,53 +17,6 @@
package com.juick.www.api.webfinger;
-import com.juick.model.User;
-import com.juick.www.api.webfinger.model.Account;
-import com.juick.www.api.webfinger.model.Link;
-import com.juick.util.HttpNotFoundException;
-import com.juick.service.UserService;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriComponentsBuilder;
-import rocks.xmpp.addr.Jid;
-
-import jakarta.inject.Inject;
-import java.util.List;
-
-import static com.juick.www.api.activity.model.Context.ACTIVITY_MEDIA_TYPE;
-
-@RestController
public class Resource {
public static final String MEDIA_TYPE = "application/jrd+json";
- @Inject
- private UserService userService;
- @Value("${web_domain:localhost}")
- private String domain;
- @Value("${ap_base_uri:http://localhost:8080/}")
- private String baseUri;
-
- @GetMapping(value = "/.well-known/webfinger", produces = {
- Resource.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE })
- public Account getWebResource(@RequestParam String resource) {
- if (resource.startsWith("acct:")) {
- try {
- Jid account = Jid.of(resource.substring(5));
- if (account.getDomain().equals(domain)) {
- User user = userService.getUserByName(account.getLocal());
- if (!user.isAnonymous()) {
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri);
- builder.path(String.format("/u/%s", user.getName()));
- Link blog = new Link("self", ACTIVITY_MEDIA_TYPE, builder.toUriString());
- return new Account(resource, List.of(blog));
- }
- }
- } catch (NullPointerException | IllegalArgumentException e) {
- throw new HttpNotFoundException();
- }
- }
- throw new HttpNotFoundException();
- }
}
diff --git a/src/main/java/com/juick/www/api/xnodeinfo2/Info.java b/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
index fc27dc66..adbd5712 100644
--- a/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
+++ b/src/main/java/com/juick/www/api/xnodeinfo2/Info.java
@@ -17,27 +17,14 @@
package com.juick.www.api.xnodeinfo2;
-import com.cliqset.xrd.Link;
-import com.cliqset.xrd.XRD;
import com.fasterxml.jackson.annotation.JsonView;
import com.juick.service.InfoService;
import com.juick.www.api.xnodeinfo2.model.*;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.MediaType;
-import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriComponentsBuilder;
-
import jakarta.inject.Inject;
-import java.net.URI;
-import java.time.ZonedDateTime;
-import java.time.temporal.ChronoUnit;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
@RestController
public class Info {
@@ -53,18 +40,6 @@ public class Info {
return infoService.getCurrentNodeInfo("1.0");
}
- @GetMapping(value = "/.well-known/nodeinfo", produces = MediaType.APPLICATION_JSON_VALUE)
- public XRD getNodeInfoLinks() {
- Link nodeinfo = new Link();
- nodeinfo.setRel(URI.create("http://nodeinfo.diaspora.software/ns/schema/2.0"));
- UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseUri);
- uriComponentsBuilder.replacePath("/api/nodeinfo/2.0");
- nodeinfo.setHref(uriComponentsBuilder.build().toUri());
- XRD xrd = new XRD();
- xrd.setLinks(Collections.singletonList(nodeinfo));
- return xrd;
- }
-
@GetMapping(value = "/api/nodeinfo/2.0", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(NodeInfo.NodeInfoView.class)
public NodeInfo showNodeInfo() {
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index 449275c3..11f31efb 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -194,7 +194,7 @@ public class Settings {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("account")));
message.setSubject("Juick authorization link");
message.setText(String.format("Follow link to attach this email to Juick account:\n" +
- "http://juick.com/settings?page=auth-email&code=%s\n\n" +
+ "https://juick.com/settings?page=auth-email&code=%s\n\n" +
"If you don't know, what this mean - just ignore this mail.\n", authCode));
Transport.send(message);
result = "<p>Authorization link has been sent to your email. Follow it to proceed.</p>" +
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/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>