├── img.png ├── img_1.png ├── img_2.png ├── img_3.png ├── img_4.png ├── img_5.png ├── src ├── main │ ├── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── logback-spring.xml │ └── kotlin │ │ └── site │ │ └── notion │ │ └── timothypro │ │ ├── bean │ │ ├── AccessLogItem.kt │ │ ├── Language.kt │ │ └── PageObj.kt │ │ ├── util │ │ ├── Prototype.kt │ │ └── TextUtil.kt │ │ ├── NotionWechatSnippetsApplication.kt │ │ ├── context │ │ └── RequestRecordContext.kt │ │ ├── controller │ │ ├── IndexController.kt │ │ ├── BingImageController.kt │ │ └── SnippetsController.kt │ │ └── service │ │ ├── NotionService.kt │ │ ├── BingImageService.kt │ │ └── SnippetsService.kt └── test │ └── kotlin │ └── site │ └── notion │ └── timothypro │ └── NotionWechatSnippetsApplicationTests.kt ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── Dockerfile ├── README.md ├── docker-compose.yml ├── .gitignore ├── logs ├── cem-boss-server.2021-10-11.log ├── cem-boss-server.2021-10-09.log ├── cem-boss-server.2021-10-16.log ├── cem-boss-server.log └── cem-boss-server.2021-10-12.log ├── pom.xml ├── mvnw.cmd └── mvnw /img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img.png -------------------------------------------------------------------------------- /img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img_1.png -------------------------------------------------------------------------------- /img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img_2.png -------------------------------------------------------------------------------- /img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img_3.png -------------------------------------------------------------------------------- /img_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img_4.png -------------------------------------------------------------------------------- /img_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/img_5.png -------------------------------------------------------------------------------- /src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | server.port=65000 2 | app.notion.notion-version=2021-08-16 -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifedever/notion-text-snippets/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | server.port=65000 2 | app.notion.notion-version=2021-08-16 3 | 4 | app.wallpaper.storage-path=/docker/wallpaper -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/bean/AccessLogItem.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.bean 2 | 3 | import java.util.* 4 | 5 | data class AccessLogItem( 6 | val ip: String, 7 | val accessTime: Date 8 | ) -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/bean/Language.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.bean 2 | 3 | /** 4 | * @author gefangshuai 5 | * @createDate: 2021/11/28 6 | */ 7 | enum class Language { 8 | zh_CN, 9 | en_US 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/util/Prototype.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.util 2 | 3 | fun String.pathAppend(path: String): String { 4 | return this.removeSuffix("/") + "/" + path.removeSuffix("/").removePrefix("/") 5 | } -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.cn-hangzhou.aliyuncs.com/noyi/open-jdk-8:1.0.0 2 | ENV project="notion-text-snippets" 3 | 4 | WORKDIR /docker 5 | COPY ./target/${project}*.jar ./app.jar 6 | EXPOSE 65000 7 | ENTRYPOINT ["java","-Xms256m","-Xmx256m","-Duser.timezone=GMT+08","-jar","./app.jar","-c"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Notion Text Snippets 2 | ---- 3 | # 更新记录 4 | ## 2022-03-29 5 | - 增加每日Bing壁纸 6 | 7 | # 使用说明 8 | Notion + iOS快捷指令实现的随时随地文本收集功能 9 | ![img_1.png](img_1.png) 10 | 11 | - [配合快捷指令实现文字快速收藏到notion(Save to Notion)](https://corebook.notion.site/notion-Save-to-Notion-f7e8fb296612427595f95f75ce9b62ad) 12 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=@profileActive@ 2 | server.port=65000 3 | # title max length 4 | app.notion.title.max-length=30 5 | app.notion.notion-version=2021-08-16 6 | app.notion.notion-url=https://api.notion.com/v1/pages 7 | 8 | app.wallpaper.storage-path=/Users/gefangshuai/Pictures/bing-wallpaper/ -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | app: 5 | build: 6 | context: ./ 7 | dockerfile: Dockerfile 8 | ports: 9 | - "65000:65000" 10 | restart: always 11 | volumes: 12 | - /opt/notion-text-snippets/logs:/docker/logs 13 | - /opt/notion-text-snippets/wallpaper:/docker/wallpaper -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/NotionWechatSnippetsApplication.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication 4 | import org.springframework.boot.runApplication 5 | 6 | @SpringBootApplication 7 | class NotionWechatSnippetsApplication 8 | 9 | fun main(args: Array) { 10 | runApplication(*args) 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/bean/PageObj.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.bean 2 | 3 | import cn.hutool.json.JSONObject 4 | 5 | /** 6 | * @author gefangshuai 7 | * @createDate: 2021/10/7 8 | */ 9 | data class PageObj( 10 | var parent: Parent? = null, 11 | var properties: MutableMap? = null, 12 | var children: List>? = null, 13 | ) { 14 | data class Parent( 15 | val database_id: String 16 | ) 17 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/context/RequestRecordContext.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.context 2 | 3 | import cn.hutool.extra.servlet.ServletUtil 4 | import org.springframework.stereotype.Component 5 | import site.notion.timothypro.bean.AccessLogItem 6 | import java.util.Date 7 | import javax.servlet.http.HttpServletRequest 8 | 9 | /** 10 | * @author gefangshuai 11 | * @date 2022/3/9 12 | */ 13 | @Component 14 | class RequestRecordContext { 15 | private var logs: MutableList = mutableListOf() 16 | 17 | fun log(request: HttpServletRequest) { 18 | logs.add( 19 | AccessLogItem( 20 | ip = ServletUtil.getClientIP(request), 21 | accessTime = Date() 22 | ) 23 | ) 24 | } 25 | 26 | fun getLogs() = logs 27 | 28 | } -------------------------------------------------------------------------------- /src/test/kotlin/site/notion/timothypro/NotionWechatSnippetsApplicationTests.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro 2 | 3 | import org.junit.jupiter.api.Test 4 | import site.notion.timothypro.util.TextUtil 5 | import kotlin.math.log 6 | 7 | //@SpringBootTest 8 | class NotionWechatSnippetsApplicationTests { 9 | 10 | @Test 11 | fun pullLinks() { 12 | val str = 13 | "我公司的网址是https://www.manyibar.com,但是我的博客网址是http://corebook.notion.site这个,而我这篇文章的地址是:https://corebook.notion.site/C-9f13478da6fc4974a86a72f1cd6f337a" 14 | val links = TextUtil.getLinks(str) 15 | val regex = "https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]" 16 | val seqs = str.splitToSequence(*links.toTypedArray()) 17 | seqs.forEach { 18 | println(it) 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/util/TextUtil.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.util 2 | 3 | import java.util.regex.Matcher 4 | import java.util.regex.Pattern 5 | 6 | 7 | /** 8 | * @author gefangshuai 9 | * @createDate: 2021/10/17 10 | */ 11 | object TextUtil { 12 | /** 13 | * 提取文本中的超链接 14 | */ 15 | fun getLinks(text: String): MutableList { 16 | val links = mutableListOf() 17 | val regex = "https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]" 18 | val p: Pattern = Pattern.compile(regex) 19 | val m: Matcher = p.matcher(text) 20 | while (m.find()) { 21 | var urlStr: String = m.group() 22 | if (urlStr.startsWith("(") && urlStr.endsWith(")")) { 23 | urlStr = urlStr.substring(1, urlStr.length - 1) 24 | } 25 | links.add(urlStr) 26 | } 27 | return links 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/controller/IndexController.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.controller 2 | 3 | import org.springframework.beans.factory.annotation.Autowired 4 | import org.springframework.web.bind.annotation.GetMapping 5 | import org.springframework.web.bind.annotation.RestController 6 | import site.notion.timothypro.context.RequestRecordContext 7 | import java.time.LocalDate 8 | import java.time.LocalDateTime 9 | import java.util.* 10 | 11 | /** 12 | * @author gefangshuai 13 | * @createDate: 2021/10/9 14 | */ 15 | @RestController 16 | class IndexController { 17 | @Autowired 18 | private lateinit var requestRecordContext: RequestRecordContext 19 | 20 | @GetMapping("/") 21 | fun hello(): Map { 22 | return mapOf( 23 | "Greet" to "Hello Notion Text Snippets!", 24 | "Timestamp" to LocalDateTime.now(), 25 | "Call times (Since server up)" to requestRecordContext.getLogs().size, 26 | "Visitors (Statistics by IP)" to requestRecordContext.getLogs().groupBy { it.ip }.size 27 | ) 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/controller/BingImageController.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.controller 2 | 3 | import org.joda.time.DateTime 4 | import org.springframework.beans.factory.annotation.Autowired 5 | import org.springframework.web.bind.annotation.* 6 | import site.notion.timothypro.service.BingImageService 7 | import javax.servlet.http.HttpServletResponse 8 | 9 | @RestController 10 | @RequestMapping("/bing/image") 11 | @CrossOrigin(origins = ["*"]) 12 | class BingImageController { 13 | @Autowired 14 | private lateinit var bingImageService: BingImageService 15 | 16 | @GetMapping 17 | fun getImage(response: HttpServletResponse, @RequestParam(defaultValue = "zh-CN") mkt: String) { 18 | try { 19 | response.setHeader("Content-Type", "image/png") 20 | response.contentType = "image/png" 21 | response.setDateHeader("expires", DateTime.now().plusHours(6).millis) 22 | response.setHeader("Cache-Control", "Public") 23 | response.setHeader("Pragma", "Public") 24 | bingImageService.getImage(response.outputStream, mkt) 25 | response.flushBuffer() 26 | } catch (e: Exception) { 27 | e.printStackTrace() 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/controller/SnippetsController.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.controller 2 | 3 | import org.springframework.beans.factory.annotation.Autowired 4 | import org.springframework.http.ResponseEntity 5 | import org.springframework.web.bind.annotation.* 6 | import site.notion.timothypro.bean.Language 7 | import site.notion.timothypro.context.RequestRecordContext 8 | import site.notion.timothypro.service.SnippetsService 9 | import java.util.* 10 | import javax.servlet.http.HttpServletRequest 11 | 12 | /** 13 | * @author gefangshuai 14 | * @createDate: 2021/10/7 15 | */ 16 | @RequestMapping("/snippets") 17 | @RestController 18 | class SnippetsController { 19 | @Autowired 20 | private lateinit var snippetsService: SnippetsService 21 | 22 | @Autowired 23 | private lateinit var requestRecordContext: RequestRecordContext 24 | 25 | /** 26 | * @param token 27 | * @param parentId PageId 28 | * @param language Language 29 | */ 30 | @PostMapping 31 | fun save( 32 | @RequestHeader token: String, 33 | @RequestHeader parentId: String, 34 | @RequestHeader(defaultValue = "zh_CN") language: Language, 35 | content: String, 36 | request: HttpServletRequest 37 | ): ResponseEntity { 38 | val response = snippetsService.save(data = content, token = token, parentId = parentId, language = language) 39 | requestRecordContext.log(request) 40 | return ResponseEntity.status(response.code).body(response.body?.string()) 41 | } 42 | 43 | @GetMapping 44 | fun hello(): Map { 45 | return mapOf( 46 | "greet" to "Hello World", 47 | "timestamp" to Date() 48 | ) 49 | } 50 | } -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/service/NotionService.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.service 2 | 3 | import cn.hutool.json.JSONObject 4 | import okhttp3.MediaType 5 | import okhttp3.MediaType.Companion.toMediaType 6 | import okhttp3.OkHttpClient 7 | import okhttp3.Request 8 | import okhttp3.RequestBody.Companion.toRequestBody 9 | import okhttp3.Response 10 | import org.slf4j.LoggerFactory 11 | import org.springframework.beans.factory.annotation.Value 12 | import org.springframework.stereotype.Service 13 | import site.notion.timothypro.bean.PageObj 14 | 15 | /** 16 | * @author gefangshuai 17 | * @createDate: 2021/10/7 18 | */ 19 | @Service 20 | class NotionService { 21 | @Value("\${app.notion.notion-version}") 22 | private lateinit var notionVersion: String 23 | 24 | @Value("\${app.notion.notion-url}") 25 | private lateinit var notionApiUrl: String 26 | 27 | private var client: OkHttpClient? = null 28 | private val logger = LoggerFactory.getLogger(NotionService::class.java) 29 | 30 | companion object { 31 | val JSON: MediaType = "application/json; charset=utf-8".toMediaType() 32 | } 33 | 34 | private fun getClient(): OkHttpClient { 35 | if (client == null) client = OkHttpClient() 36 | return client!! 37 | } 38 | 39 | private fun initPostRequest(url: String, token: String): Request.Builder { 40 | return Request.Builder() 41 | .header("Authorization", "Bearer $token") 42 | .header("Notion-Version", notionVersion) 43 | .header("Content-Type", "application/json") 44 | .url(url) 45 | } 46 | 47 | fun createPage(page: PageObj, token: String, parentId: String): Response { 48 | page.parent = PageObj.Parent(parentId) 49 | val data = JSONObject(page).toString() 50 | val request = initPostRequest(notionApiUrl, token) 51 | .post( 52 | data.toRequestBody(JSON) 53 | ).build() 54 | logger.debug("Post JSON: $data") 55 | return this.getClient().newCall(request).execute() 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ${LOG_ROOT}/${LOG_FILE_NAME}.log 16 | 17 | 18 | ${LOG_ROOT}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.log 19 | ${MAX_HISTORY} 20 | 21 | 22 | ${FILE_LOG_PATTERN} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/service/BingImageService.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.service 2 | 3 | import cn.hutool.core.io.FileUtil 4 | import cn.hutool.http.HttpRequest 5 | import cn.hutool.http.HttpUtil 6 | import cn.hutool.json.JSONObject 7 | import org.apache.commons.io.IOUtils 8 | import org.joda.time.DateTime 9 | import org.slf4j.LoggerFactory 10 | import org.springframework.beans.factory.annotation.Value 11 | import org.springframework.stereotype.Service 12 | import site.notion.timothypro.util.pathAppend 13 | import java.io.File 14 | import java.io.FileInputStream 15 | import java.io.OutputStream 16 | 17 | @Service 18 | class BingImageService { 19 | private val logger = LoggerFactory.getLogger(BingImageService::class.java) 20 | 21 | @Value("\${app.wallpaper.storage-path}") 22 | private lateinit var wrapperStoragePath: String 23 | 24 | /** 25 | 26 | 参数名称 值含义 27 | format(非必需) 返回数据格式,不存在返回xml格式 28 | js (返回json格式,一般使用这个) 29 | xml(返回xml格式) 30 | idx (非必需) 请求图片截止天数 31 | 0 今天 32 | -1 截止至明天(预准备的) 33 | 1 截止至昨天,类推(目前最多获取到16天前的图片) 34 | n(必需) 1-8 返回请求数量,目前最多一次获取8张 35 | mkt(非必需) 地区 36 | zh-CN 37 | ... 38 | */ 39 | 40 | fun getImage(outputStream: OutputStream, mkt: String) { 41 | val destPath = wrapperStoragePath.pathAppend(mkt).pathAppend(DateTime.now().toString("yyyy-MM-dd").plus(".jpg")) 42 | FileUtil.mkParentDirs(destPath) 43 | val imageFile = File(destPath) 44 | if (!imageFile.exists()) 45 | HttpUtil.downloadFile(getImageUrl(mkt), imageFile) 46 | 47 | val inputStream = FileInputStream(imageFile) 48 | IOUtils.copy(inputStream, outputStream) 49 | IOUtils.close(inputStream) 50 | } 51 | 52 | fun getImageUrl(mkt: String): String { 53 | val apiUrl = "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=${mkt}" 54 | val bingURL = "https://www.bing.com" 55 | val responseStr = HttpRequest.get(apiUrl) 56 | .header("Referer", bingURL) 57 | .header( 58 | "User-Agent", 59 | "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/8.0; .NET4.0C; .NET4.0E)" 60 | ).execute() 61 | .body() 62 | logger.info("responseStr: {}", responseStr) 63 | return JSONObject(responseStr).getByPath("images[0].url").toString().let { 64 | bingURL.pathAppend(it) 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /logs/cem-boss-server.2021-10-11.log: -------------------------------------------------------------------------------- 1 | [2021-10-11 23:53:58.601] INFO 15631 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 15631 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 2 | [2021-10-11 23:53:58.649] INFO 15631 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 3 | [2021-10-11 23:54:00.951] INFO 15631 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 4 | [2021-10-11 23:54:00.978] INFO 15631 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 5 | [2021-10-11 23:54:00.979] INFO 15631 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 6 | [2021-10-11 23:54:01.116] INFO 15631 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 7 | [2021-10-11 23:54:01.117] INFO 15631 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2334 ms 8 | [2021-10-11 23:54:02.028] INFO 15631 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 9 | [2021-10-11 23:54:02.051] INFO 15631 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 5.51 seconds (JVM running for 7.505) 10 | [2021-10-11 23:54:42.916] INFO 15631 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 11 | [2021-10-11 23:54:42.917] INFO 15631 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 12 | [2021-10-11 23:54:42.918] INFO 15631 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 13 | [2021-10-11 23:54:43.125] INFO 15631 --- [http-nio-65000-exec-1] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 14 | [2021-10-11 23:55:31.557] INFO 15631 --- [http-nio-65000-exec-2] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"type":"text","text":{"content":"测试文本收集😄"},"object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 15 | [2021-10-11 23:58:08.645] INFO 15631 --- [http-nio-65000-exec-3] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 16 | -------------------------------------------------------------------------------- /logs/cem-boss-server.2021-10-09.log: -------------------------------------------------------------------------------- 1 | [2021-10-09 22:24:51.754] INFO 3939 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 3939 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 2 | [2021-10-09 22:24:51.758] INFO 3939 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 3 | [2021-10-09 22:24:53.389] INFO 3939 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 4 | [2021-10-09 22:24:53.410] INFO 3939 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 5 | [2021-10-09 22:24:53.410] INFO 3939 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 6 | [2021-10-09 22:24:53.516] INFO 3939 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 7 | [2021-10-09 22:24:53.516] INFO 3939 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1700 ms 8 | [2021-10-09 22:24:54.278] INFO 3939 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 9 | [2021-10-09 22:24:54.291] INFO 3939 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 3.11 seconds (JVM running for 3.932) 10 | [2021-10-09 22:25:05.267] INFO 3939 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 11 | [2021-10-09 22:25:05.268] INFO 3939 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 12 | [2021-10-09 22:25:05.269] INFO 3939 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 13 | [2021-10-09 22:30:37.819] INFO 4056 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 4056 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 14 | [2021-10-09 22:30:37.823] INFO 4056 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 15 | [2021-10-09 22:30:38.884] INFO 4056 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 16 | [2021-10-09 22:30:38.898] INFO 4056 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 17 | [2021-10-09 22:30:38.899] INFO 4056 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 18 | [2021-10-09 22:30:38.988] INFO 4056 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 19 | [2021-10-09 22:30:38.988] INFO 4056 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1113 ms 20 | [2021-10-09 22:30:39.577] INFO 4056 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 21 | [2021-10-09 22:30:39.589] INFO 4056 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 2.222 seconds (JVM running for 2.998) 22 | [2021-10-09 22:33:12.078] INFO 4056 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 23 | [2021-10-09 22:33:12.078] INFO 4056 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 24 | [2021-10-09 22:33:12.080] INFO 4056 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 25 | [2021-10-09 22:33:12.236] INFO 4056 --- [http-nio-65000-exec-1] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 26 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.0 9 | 10 | 11 | site.notion.timothy-pro 12 | notion-text-snippets 13 | 0.0.1 14 | notion-text-snippets 15 | notion-text-snippets 16 | 17 | 1.8 18 | 1.6.21 19 | 20 | 21 | 22 | dev 23 | 24 | dev 25 | compile 26 | 27 | 28 | true 29 | 30 | 31 | 32 | prod 33 | 34 | prod 35 | compile 36 | 37 | 38 | 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-web 43 | 44 | 45 | com.fasterxml.jackson.module 46 | jackson-module-kotlin 47 | 48 | 49 | commons-io 50 | commons-io 51 | 2.11.0 52 | 53 | 54 | joda-time 55 | joda-time 56 | 2.10.13 57 | 58 | 59 | org.jetbrains.kotlin 60 | kotlin-reflect 61 | 62 | 63 | org.jetbrains.kotlin 64 | kotlin-stdlib-jdk8 65 | 66 | 67 | commons-validator 68 | commons-validator 69 | 1.7 70 | 71 | 72 | org.jsoup 73 | jsoup 74 | 1.14.3 75 | 76 | 77 | 78 | com.squareup.okhttp3 79 | okhttp 80 | 4.9.3 81 | 82 | 83 | cn.hutool 84 | hutool-all 85 | 5.7.21 86 | 87 | 88 | org.springframework.boot 89 | spring-boot-starter-test 90 | test 91 | 92 | 93 | 94 | 95 | ${project.basedir}/src/main/kotlin 96 | ${project.basedir}/src/test/kotlin 97 | 98 | 99 | org.springframework.boot 100 | spring-boot-maven-plugin 101 | 102 | 103 | org.jetbrains.kotlin 104 | kotlin-maven-plugin 105 | 106 | 107 | -Xjsr305=strict 108 | 109 | 110 | spring 111 | 112 | 113 | 114 | 115 | org.jetbrains.kotlin 116 | kotlin-maven-allopen 117 | ${kotlin.version} 118 | 119 | 120 | 121 | 122 | ${artifactId} 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /logs/cem-boss-server.2021-10-16.log: -------------------------------------------------------------------------------- 1 | [2021-10-16 18:06:52.097] INFO 96894 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 96894 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 2 | [2021-10-16 18:06:52.106] INFO 96894 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 3 | [2021-10-16 18:06:53.584] INFO 96894 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 4 | [2021-10-16 18:06:53.597] INFO 96894 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 5 | [2021-10-16 18:06:53.598] INFO 96894 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 6 | [2021-10-16 18:06:53.674] INFO 96894 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 7 | [2021-10-16 18:06:53.675] INFO 96894 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1456 ms 8 | [2021-10-16 18:06:54.255] INFO 96894 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 9 | [2021-10-16 18:06:54.269] INFO 96894 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 3.245 seconds (JVM running for 4.553) 10 | [2021-10-16 18:08:07.275] INFO 96894 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 11 | [2021-10-16 18:08:07.276] INFO 96894 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 12 | [2021-10-16 18:08:07.277] INFO 96894 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 13 | [2021-10-16 18:08:07.298] WARN 96894 --- [http-nio-65000-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 14 | [2021-10-16 18:08:12.834] WARN 96894 --- [http-nio-65000-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 15 | [2021-10-16 18:08:54.787] INFO 96932 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 96932 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 16 | [2021-10-16 18:08:54.790] INFO 96932 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 17 | [2021-10-16 18:08:56.123] INFO 96932 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 18 | [2021-10-16 18:08:56.138] INFO 96932 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 19 | [2021-10-16 18:08:56.139] INFO 96932 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 20 | [2021-10-16 18:08:56.233] INFO 96932 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 21 | [2021-10-16 18:08:56.234] INFO 96932 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1390 ms 22 | [2021-10-16 18:08:56.676] INFO 96932 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 23 | [2021-10-16 18:08:56.686] INFO 96932 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 2.411 seconds (JVM running for 3.201) 24 | [2021-10-16 18:09:24.235] INFO 96932 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 25 | [2021-10-16 18:09:24.236] INFO 96932 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 26 | [2021-10-16 18:09:24.237] INFO 96932 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 27 | [2021-10-16 18:09:24.250] WARN 96932 --- [http-nio-65000-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 28 | [2021-10-16 18:10:53.886] INFO 96932 --- [http-nio-65000-exec-3] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"https://www.manyibar.com/"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://www.manyibar.com/"},"content":"https://www.manyibar.com/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"满意吧首页-专业好用的客户体验管理CEM平台-顾客满意度调查问卷表模板 - 满意吧"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 29 | [2021-10-16 18:12:55.111] INFO 96932 --- [http-nio-65000-exec-4] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"https://www.manyibar.com/"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://www.manyibar.com/"},"content":"https://www.manyibar.com/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"满意吧首页-专业好用的客户体验管理CEM平台-顾客满意度调查问卷表模板 - 满意吧"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 30 | [2021-10-16 18:13:37.542] INFO 96932 --- [http-nio-65000-exec-5] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"https://www.manyibar.com/"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://www.manyibar.com/"},"content":"https://www.manyibar.com/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"满意吧首页-专业好用的客户体验管理CEM平台-顾客满意度调查问卷表模板 - 满意吧"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 31 | [2021-10-16 18:13:48.586] INFO 96932 --- [http-nio-65000-exec-6] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://www.manyibar.com/"},"content":"https://www.manyibar.com/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"满意吧首页-专业好用的客户体验管理CEM平台-顾客满意度调查问卷表模板 - 满意吧"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 32 | [2021-10-16 18:14:00.194] WARN 96932 --- [http-nio-65000-exec-7] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 33 | [2021-10-16 18:14:15.848] WARN 96932 --- [http-nio-65000-exec-8] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 34 | [2021-10-16 18:14:26.708] WARN 96932 --- [http-nio-65000-exec-9] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 35 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /logs/cem-boss-server.log: -------------------------------------------------------------------------------- 1 | [2021-10-17 21:44:18.361] INFO 2903 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 2903 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 2 | [2021-10-17 21:44:18.375] INFO 2903 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 3 | [2021-10-17 21:44:20.461] INFO 2903 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 4 | [2021-10-17 21:44:20.479] INFO 2903 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 5 | [2021-10-17 21:44:20.480] INFO 2903 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 6 | [2021-10-17 21:44:20.617] INFO 2903 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 7 | [2021-10-17 21:44:20.618] INFO 2903 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2110 ms 8 | [2021-10-17 21:44:21.238] INFO 2903 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 9 | [2021-10-17 21:44:21.249] INFO 2903 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 4.021 seconds (JVM running for 5.155) 10 | [2021-10-17 21:45:17.125] INFO 2903 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 11 | [2021-10-17 21:45:17.126] INFO 2903 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 12 | [2021-10-17 21:45:17.127] INFO 2903 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 13 | [2021-10-17 21:45:17.283] ERROR 2903 --- [http-nio-65000-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IndexOutOfBoundsException: Index: 3, Size: 3] with root cause 14 | 15 | java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 16 | at java.util.ArrayList.rangeCheck(ArrayList.java:659) 17 | at java.util.ArrayList.get(ArrayList.java:435) 18 | at site.notion.timothypro.service.SnippetsService.resolveBlock(SnippetsService.kt:166) 19 | at site.notion.timothypro.service.SnippetsService.getChildren(SnippetsService.kt:129) 20 | at site.notion.timothypro.service.SnippetsService.parseNormal(SnippetsService.kt:91) 21 | at site.notion.timothypro.service.SnippetsService.save(SnippetsService.kt:45) 22 | at site.notion.timothypro.controller.SnippetsController.save(SnippetsController.kt:20) 23 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 24 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 25 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 26 | at java.lang.reflect.Method.invoke(Method.java:498) 27 | at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) 28 | at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) 29 | at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) 30 | at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) 31 | at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) 32 | at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) 33 | at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) 34 | at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) 35 | at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) 36 | at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) 37 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) 38 | at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) 39 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) 40 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) 41 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 42 | at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 43 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 44 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 45 | at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) 46 | at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 47 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 48 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 49 | at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) 50 | at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 51 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 52 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 53 | at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) 54 | at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 55 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) 56 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) 57 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) 58 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) 59 | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) 60 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) 61 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) 62 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) 63 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) 64 | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) 65 | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) 66 | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) 67 | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726) 68 | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 69 | at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) 70 | at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) 71 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 72 | at java.lang.Thread.run(Thread.java:748) 73 | 74 | -------------------------------------------------------------------------------- /src/main/kotlin/site/notion/timothypro/service/SnippetsService.kt: -------------------------------------------------------------------------------- 1 | package site.notion.timothypro.service 2 | 3 | import cn.hutool.json.JSONArray 4 | import okhttp3.Response 5 | import org.apache.commons.validator.routines.UrlValidator 6 | import org.jsoup.Jsoup 7 | import org.jsoup.nodes.Document 8 | import org.springframework.beans.factory.annotation.Autowired 9 | import org.springframework.beans.factory.annotation.Value 10 | import org.springframework.stereotype.Service 11 | import site.notion.timothypro.bean.Language 12 | import site.notion.timothypro.bean.PageObj 13 | import site.notion.timothypro.util.TextUtil 14 | 15 | 16 | /** 17 | * @author gefangshuai 18 | * @createDate: 2021/10/7 19 | */ 20 | @Service 21 | class SnippetsService { 22 | @Autowired 23 | private lateinit var notionService: NotionService 24 | 25 | @Value("\${app.notion.title.max-length}") 26 | private var titleMaxLength: Int = 0 27 | 28 | private fun getTagKey(language: Language): String { 29 | return when (language) { 30 | Language.zh_CN -> "标签" 31 | Language.en_US -> "Tags" 32 | } 33 | } 34 | 35 | private fun getDefaultTagName(language: Language): String { 36 | return when (language) { 37 | Language.zh_CN -> "未分类" 38 | Language.en_US -> "Unsorted" 39 | } 40 | } 41 | 42 | fun save(data: String, token: String, parentId: String, language: Language): Response { 43 | val blocks = data.split("\n") 44 | if (blocks.isEmpty()) throw Exception("no data!") 45 | // 标签 46 | val tags = this.getTags( 47 | blocks = blocks, 48 | language = language 49 | ) 50 | // 页面 51 | val page = if (blocks.size == 1) { 52 | val url = if (blocks.first().contains("#") && blocks.first().split("#").size == 2) { 53 | blocks.first().split("#").first() 54 | } else { 55 | blocks.first() 56 | }.trim() 57 | if (UrlValidator.getInstance().isValid(url)) { 58 | this.parseUrl(url, tags, language) 59 | } else { 60 | this.parseNormal(blocks, tags, language) 61 | } 62 | } else { 63 | this.parseNormal(blocks, tags, language) 64 | } 65 | return notionService.createPage(page = page, token = token, parentId = parentId) 66 | } 67 | 68 | private fun getTags(blocks: List, language: Language): JSONArray { 69 | val tags = JSONArray() 70 | blocks.findLast { it.contains("#") }?.let { block -> 71 | block.split("#").lastOrNull()?.trim()?.let { tag -> 72 | tags.put(mapOf("name" to tag)) 73 | } 74 | } ?: let { 75 | tags.put(mapOf("name" to this.getDefaultTagName(language))) 76 | } 77 | return tags 78 | } 79 | 80 | /** 81 | * 解析url 82 | */ 83 | private fun parseUrl(url: String, tags: JSONArray, language: Language): PageObj { 84 | val doc: Document = Jsoup.connect(url).get() 85 | val title = doc.title() 86 | val children = listOf( 87 | mutableMapOf( 88 | "object" to "block", 89 | "type" to "paragraph", 90 | "paragraph" to mapOf( 91 | "text" to listOf( 92 | mapOf( 93 | "type" to "text", 94 | "text" to mapOf( 95 | "content" to url, 96 | "link" to mapOf( 97 | "url" to url 98 | ) 99 | ) 100 | ) 101 | ) 102 | ) 103 | ) 104 | ) 105 | val page = PageObj() 106 | page.properties = this.getProperties(title, tags, language) 107 | page.children = children 108 | return page 109 | } 110 | 111 | /** 112 | * 普通解析 113 | */ 114 | private fun parseNormal(blocks: List, tags: JSONArray, language: Language): PageObj { 115 | val page = PageObj() 116 | val title = blocks.first().trim().let { 117 | if (it.length > titleMaxLength) { 118 | it.substring(0, titleMaxLength).plus("...") 119 | } else it 120 | } 121 | page.properties = this.getProperties( 122 | title = title, 123 | tags = tags, 124 | language = language 125 | ) 126 | page.children = this.getChildren(blocks) 127 | return page 128 | } 129 | 130 | /** 131 | * 获取属性 132 | */ 133 | private fun getProperties(title: String, tags: JSONArray, language: Language): MutableMap { 134 | val properties: MutableMap = 135 | mutableMapOf( 136 | "Name" to mapOf( 137 | "title" to listOf( 138 | mapOf( 139 | "type" to "text", 140 | "text" to mapOf( 141 | "content" to title 142 | ) 143 | ) 144 | ) 145 | ) 146 | ) 147 | if (tags.isNotEmpty()) { 148 | properties[this.getTagKey(language)] = mapOf( 149 | "multi_select" to tags 150 | ) 151 | } 152 | return properties 153 | } 154 | 155 | /** 156 | * 获取文章内容 157 | */ 158 | private fun getChildren(blocks: List): List> { 159 | return blocks.filter { it.isNotBlank() }.map { block -> 160 | mutableMapOf( 161 | "object" to "block", 162 | "type" to "paragraph", 163 | "paragraph" to mapOf( 164 | "text" to this.resolveBlock(block) 165 | ) 166 | ) 167 | } 168 | } 169 | 170 | /** 171 | * 解析一行数据 172 | * - url 解析 173 | */ 174 | private fun resolveBlock(block: String): List> { 175 | val links = TextUtil.getLinks(block) 176 | return if (links.isEmpty()) { 177 | listOf( 178 | mapOf( 179 | "type" to "text", 180 | "text" to mapOf( 181 | "content" to block 182 | ) 183 | ) 184 | ) 185 | } else { 186 | val texts = block.splitToSequence(*links.toTypedArray()) 187 | val results = mutableListOf>() 188 | texts.forEachIndexed { index, txt -> 189 | results.add( 190 | mapOf( 191 | "type" to "text", 192 | "text" to mapOf( 193 | "content" to txt 194 | ) 195 | ) 196 | ) 197 | if (index < links.size) { 198 | results.add( 199 | mapOf( 200 | "type" to "text", 201 | "text" to mapOf( 202 | "content" to links[index], 203 | "link" to mapOf( 204 | "url" to links[index] 205 | ) 206 | ) 207 | ) 208 | ) 209 | } 210 | } 211 | 212 | return results 213 | } 214 | } 215 | } -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | # Provide a "standardized" way to retrieve the CLI args that will 300 | # work with both Windows and non-Windows executions. 301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 302 | export MAVEN_CMD_LINE_ARGS 303 | 304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 305 | 306 | exec "$JAVACMD" \ 307 | $MAVEN_OPTS \ 308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 311 | -------------------------------------------------------------------------------- /logs/cem-boss-server.2021-10-12.log: -------------------------------------------------------------------------------- 1 | [2021-10-12 00:01:36.698] INFO 15631 --- [http-nio-65000-exec-4] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 2 | [2021-10-12 00:03:01.939] INFO 15631 --- [http-nio-65000-exec-5] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"heading_2:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"heading_2","block":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 3 | [2021-10-12 00:07:29.542] INFO 15631 --- [http-nio-65000-exec-6] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 4 | [2021-10-12 00:07:31.674] INFO 15631 --- [http-nio-65000-exec-7] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph:":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 5 | [2021-10-12 00:14:58.502] INFO 15631 --- [http-nio-65000-exec-8] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 6 | [2021-10-12 00:16:20.816] INFO 15631 --- [http-nio-65000-exec-10] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"【叹】"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示满意或赞叹〖yes〗。如:哎,这就对了!"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示惊讶或不满意〖why〗。如:哎,你怎么不早说!"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示提醒〖lookout〗。如:哎,小声点"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示醒悟〖aha〗。如:哎!原来是这样"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示招呼〖hello〗。如:哎,大婶,我们回头再来看你"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"表示答应〖yes〗。如:“李梅!”“哎!我在给病人换药,一会儿就来。”"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"【叹】\n表示满意或赞叹〖yes〗。如:哎,这就对了!\n表示惊讶或不满意〖why〗。如:哎,你怎么不早说!\n表示提醒〖lookout〗。如:哎,小声点\n表示醒悟〖aha〗。如:哎!原来是这样\n表示招呼〖hello〗。如:哎,大婶,我们回头再来看你\n表示答应〖yes〗。如:“李梅!”“哎!我在给病人换药,一会儿就来。”"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 7 | [2021-10-12 00:16:49.265] INFO 15631 --- [http-nio-65000-exec-1] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄\n测试文本收集😄\n测试文本收集😄\n测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 8 | [2021-10-12 00:17:13.399] INFO 15631 --- [http-nio-65000-exec-2] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄\n测试文本收集😄\n测试文本收集😄\n测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 9 | [2021-10-12 00:17:33.813] INFO 15631 --- [http-nio-65000-exec-3] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"测试文本收集😄"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 10 | [2021-10-12 10:22:00.491] INFO 17009 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 17009 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 11 | [2021-10-12 10:22:00.500] INFO 17009 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 12 | [2021-10-12 10:22:02.957] INFO 17009 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 13 | [2021-10-12 10:22:02.986] INFO 17009 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 14 | [2021-10-12 10:22:02.987] INFO 17009 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 15 | [2021-10-12 10:22:03.115] INFO 17009 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 16 | [2021-10-12 10:22:03.115] INFO 17009 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2483 ms 17 | [2021-10-12 10:22:03.928] INFO 17009 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 18 | [2021-10-12 10:22:03.949] INFO 17009 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 5.917 seconds (JVM running for 7.694) 19 | [2021-10-12 10:23:13.846] INFO 17009 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 20 | [2021-10-12 10:23:13.847] INFO 17009 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 21 | [2021-10-12 10:23:13.848] INFO 17009 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 22 | [2021-10-12 10:23:14.040] INFO 17009 --- [http-nio-65000-exec-1] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"#News"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"☀️ 自留地早报【10.12】"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"🍎发布正式版软件更新"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* iOS 15.0.2 (19A404)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* iPadOS 15.0.2 (19A404)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* watchOS 8.0.1 (19R354)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"1⃣️ This is tech today:Google 或将推出类似 Apple One 的订阅套餐 名为 Pixel Pass,该套餐将 Pixel 设备延长保修和几个 Google 服务的订阅结合起来"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"2⃣️ Sammobile:三星电子与知名电影制作人合作,发起一项名为\"用 Galaxy 拍电影\"的活动"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"3⃣️ IDC:2021 年第三季度全球 PC 出货量达到 8670 万台,同比增长 3.9%,这是 PC 市场连续第六个季度出货增长,但也是疫情以来增速最低的一个季度。其中联想、惠普、戴尔第三季度仍位居市占率前三,苹果、ASUS 位列第四、第五"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"4⃣️ Microsoft Mechanics:微软演示在无 TPM、VBS 保护的计算机上黑进自家 Windows 系统"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"5⃣️ 9to5Google:谷歌正在寻求将 Fuchsia OS 操作系统从目前的 Nest Hub 智能显示器扩展到“其他智能设备”,但未确定是否包含手机"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"6⃣️ Xiaomi:“亲情守护”功能将于 10 月 30 日 12:00 停止服务,随即守护端“风筝守护 App”及被守护端“亲情守护 App”也将停止服务"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"7⃣️ Readhub:微信青少年模式上线\"监护人授权\"功能,监护人可以通过这一功能管理孩子使用微信的情况"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"8⃣️ MacRumors:Google 正逐步关闭其 IOS 应用的 Material Design 定制 UI,转而单独使用 UIKit"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"频道:@NewlearnerChannel"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"#News"}}]},"标签":{"multi_select":[{"name":"News"}]}}} 23 | [2021-10-12 10:25:56.853] INFO 17009 --- [http-nio-65000-exec-3] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"☀️ 自留地早报【10.12】"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"🍎发布正式版软件更新"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* iOS 15.0.2 (19A404)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* iPadOS 15.0.2 (19A404)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"* watchOS 8.0.1 (19R354)"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"1⃣️ This is tech today:Google 或将推出类似 Apple One 的订阅套餐 名为 Pixel Pass,该套餐将 Pixel 设备延长保修和几个 Google 服务的订阅结合起来"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"2⃣️ Sammobile:三星电子与知名电影制作人合作,发起一项名为\"用 Galaxy 拍电影\"的活动"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"3⃣️ IDC:2021 年第三季度全球 PC 出货量达到 8670 万台,同比增长 3.9%,这是 PC 市场连续第六个季度出货增长,但也是疫情以来增速最低的一个季度。其中联想、惠普、戴尔第三季度仍位居市占率前三,苹果、ASUS 位列第四、第五"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"4⃣️ Microsoft Mechanics:微软演示在无 TPM、VBS 保护的计算机上黑进自家 Windows 系统"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"5⃣️ 9to5Google:谷歌正在寻求将 Fuchsia OS 操作系统从目前的 Nest Hub 智能显示器扩展到“其他智能设备”,但未确定是否包含手机"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"6⃣️ Xiaomi:“亲情守护”功能将于 10 月 30 日 12:00 停止服务,随即守护端“风筝守护 App”及被守护端“亲情守护 App”也将停止服务"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"7⃣️ Readhub:微信青少年模式上线\"监护人授权\"功能,监护人可以通过这一功能管理孩子使用微信的情况"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"8⃣️ MacRumors:Google 正逐步关闭其 IOS 应用的 Material Design 定制 UI,转而单独使用 UIKit"}}]},"type":"paragraph","object":"block"},{"paragraph":{"text":[{"type":"text","text":{"content":"频道:@NewlearnerChannel #News"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"☀️ 自留地早报【10.12】"}}]},"标签":{"multi_select":[{"name":"News"}]}}} 24 | [2021-10-12 11:31:46.959] INFO 18406 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Starting NotionWechatSnippetsApplicationKt using Java 1.8.0_282 on gefangshuaiMacBook-Pro.local with PID 18406 (/Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets/target/classes started by gefangshuai in /Users/gefangshuai/Documents/Dev/myspace/projects/notion-text-snippets) 25 | [2021-10-12 11:31:46.965] INFO 18406 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : The following profiles are active: prod 26 | [2021-10-12 11:31:50.584] INFO 18406 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 65000 (http) 27 | [2021-10-12 11:31:50.606] INFO 18406 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 28 | [2021-10-12 11:31:50.607] INFO 18406 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53] 29 | [2021-10-12 11:31:50.719] INFO 18406 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 30 | [2021-10-12 11:31:50.720] INFO 18406 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3099 ms 31 | [2021-10-12 11:31:51.566] INFO 18406 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 65000 (http) with context path '' 32 | [2021-10-12 11:31:51.586] INFO 18406 --- [main] s.n.t.NotionWechatSnippetsApplicationKt : Started NotionWechatSnippetsApplicationKt in 7.374 seconds (JVM running for 8.931) 33 | [2021-10-12 11:31:58.818] INFO 18406 --- [http-nio-65000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 34 | [2021-10-12 11:31:58.818] INFO 18406 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 35 | [2021-10-12 11:31:58.819] INFO 18406 --- [http-nio-65000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms 36 | [2021-10-12 11:31:59.703] INFO 18406 --- [http-nio-65000-exec-1] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"callout":{"text":[{"icon":{"emoji":"⭐️"},"type":"text","text":{"content":"https://hutool.cn/docs/"}}]},"type":"callout","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]}}} 37 | [2021-10-12 11:37:54.899] INFO 18406 --- [http-nio-65000-exec-2] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"type":"quote","quote":{"text":[{"type":"text","text":{"content":"来源:https://hutool.cn/docs/"}}]},"object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]}}} 38 | [2021-10-12 11:39:49.813] INFO 18406 --- [http-nio-65000-exec-4] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"type":"quote","quote":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]}}} 39 | [2021-10-12 11:40:34.396] INFO 18406 --- [http-nio-65000-exec-5] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]}}} 40 | [2021-10-12 11:42:09.425] INFO 18406 --- [http-nio-65000-exec-7] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]},"标签":{"multi_select":[{"name":"未分类"}]}}} 41 | [2021-10-12 11:42:17.980] INFO 18406 --- [http-nio-65000-exec-8] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"https://hutool.cn/docs/ #我的"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"https://hutool.cn/docs/ #我的"}}]},"标签":{"multi_select":[{"name":"我的"}]}}} 42 | [2021-10-12 11:48:45.487] INFO 18406 --- [http-nio-65000-exec-2] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]},"标签":{"multi_select":[{"name":"我的"}]}}} 43 | [2021-10-12 11:49:03.221] INFO 18406 --- [http-nio-65000-exec-3] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]},"标签":{"multi_select":[{"name":"房东房东"}]}}} 44 | [2021-10-12 11:52:17.201] INFO 18406 --- [http-nio-65000-exec-5] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"https://hutool.cn/docs/ #我的#房东房东"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"https://hutool.cn/docs/ #我的#房东房东"}}]},"标签":{"multi_select":[{"name":"房东房东"}]}}} 45 | [2021-10-12 11:52:24.171] INFO 18406 --- [http-nio-65000-exec-6] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"link":{"url":"https://hutool.cn/docs/"},"content":"https://hutool.cn/docs/"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"Hutool参考文档"}}]},"标签":{"multi_select":[{"name":"我的"}]}}} 46 | [2021-10-12 11:52:31.069] INFO 18406 --- [http-nio-65000-exec-7] s.n.timothypro.service.NotionService : Post JSON: {"parent":{"database_id":"a1beeb546ad347649c738f8748389e07"},"children":[{"paragraph":{"text":[{"type":"text","text":{"content":"4https://hutool.cn/docs/ #我的"}}]},"type":"paragraph","object":"block"}],"properties":{"Name":{"title":[{"type":"text","text":{"content":"4https://hutool.cn/docs/ #我的"}}]},"标签":{"multi_select":[{"name":"我的"}]}}} 47 | --------------------------------------------------------------------------------