integration.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package storage // import "miniflux.app/v2/internal/storage"
  4. import (
  5. "database/sql"
  6. "fmt"
  7. "golang.org/x/crypto/bcrypt"
  8. "miniflux.app/v2/internal/model"
  9. )
  10. // HasDuplicateFeverUsername checks if another user have the same Fever username.
  11. func (s *Storage) HasDuplicateFeverUsername(userID int64, feverUsername string) bool {
  12. query := `SELECT true FROM integrations WHERE user_id != $1 AND fever_username=$2 LIMIT 1`
  13. var result bool
  14. s.db.QueryRow(query, userID, feverUsername).Scan(&result)
  15. return result
  16. }
  17. // HasDuplicateGoogleReaderUsername checks if another user have the same Google Reader username.
  18. func (s *Storage) HasDuplicateGoogleReaderUsername(userID int64, googleReaderUsername string) bool {
  19. query := `SELECT true FROM integrations WHERE user_id != $1 AND googlereader_username=$2 LIMIT 1`
  20. var result bool
  21. s.db.QueryRow(query, userID, googleReaderUsername).Scan(&result)
  22. return result
  23. }
  24. // UserByFeverToken returns a user by using the Fever API token.
  25. func (s *Storage) UserByFeverToken(token string) (*model.User, error) {
  26. query := `
  27. SELECT
  28. users.id, users.username, users.is_admin, users.timezone
  29. FROM
  30. users
  31. LEFT JOIN
  32. integrations ON integrations.user_id=users.id
  33. WHERE
  34. integrations.fever_enabled='t' AND lower(integrations.fever_token)=lower($1)
  35. `
  36. var user model.User
  37. err := s.db.QueryRow(query, token).Scan(&user.ID, &user.Username, &user.IsAdmin, &user.Timezone)
  38. switch {
  39. case err == sql.ErrNoRows:
  40. return nil, nil
  41. case err != nil:
  42. return nil, fmt.Errorf("store: unable to fetch user: %v", err)
  43. default:
  44. return &user, nil
  45. }
  46. }
  47. // GoogleReaderUserCheckPassword validates the Google Reader hashed password.
  48. func (s *Storage) GoogleReaderUserCheckPassword(username, password string) error {
  49. var hash string
  50. query := `
  51. SELECT
  52. googlereader_password
  53. FROM
  54. integrations
  55. WHERE
  56. integrations.googlereader_enabled='t' AND integrations.googlereader_username=$1
  57. `
  58. err := s.db.QueryRow(query, username).Scan(&hash)
  59. if err == sql.ErrNoRows {
  60. return fmt.Errorf(`store: unable to find this user: %s`, username)
  61. } else if err != nil {
  62. return fmt.Errorf(`store: unable to fetch user: %v`, err)
  63. }
  64. if err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)); err != nil {
  65. return fmt.Errorf(`store: invalid password for "%s" (%v)`, username, err)
  66. }
  67. return nil
  68. }
  69. // GoogleReaderUserGetIntegration returns part of the Google Reader parts of the integration struct.
  70. func (s *Storage) GoogleReaderUserGetIntegration(username string) (*model.Integration, error) {
  71. var integration model.Integration
  72. query := `
  73. SELECT
  74. user_id,
  75. googlereader_enabled,
  76. googlereader_username,
  77. googlereader_password
  78. FROM
  79. integrations
  80. WHERE
  81. integrations.googlereader_enabled='t' AND integrations.googlereader_username=$1
  82. `
  83. err := s.db.QueryRow(query, username).Scan(&integration.UserID, &integration.GoogleReaderEnabled, &integration.GoogleReaderUsername, &integration.GoogleReaderPassword)
  84. if err == sql.ErrNoRows {
  85. return &integration, fmt.Errorf(`store: unable to find this user: %s`, username)
  86. } else if err != nil {
  87. return &integration, fmt.Errorf(`store: unable to fetch user: %v`, err)
  88. }
  89. return &integration, nil
  90. }
  91. // Integration returns user integration settings.
  92. func (s *Storage) Integration(userID int64) (*model.Integration, error) {
  93. query := `
  94. SELECT
  95. user_id,
  96. pinboard_enabled,
  97. pinboard_token,
  98. pinboard_tags,
  99. pinboard_mark_as_unread,
  100. instapaper_enabled,
  101. instapaper_username,
  102. instapaper_password,
  103. fever_enabled,
  104. fever_username,
  105. fever_token,
  106. googlereader_enabled,
  107. googlereader_username,
  108. googlereader_password,
  109. wallabag_enabled,
  110. wallabag_only_url,
  111. wallabag_url,
  112. wallabag_client_id,
  113. wallabag_client_secret,
  114. wallabag_username,
  115. wallabag_password,
  116. wallabag_tags,
  117. notion_enabled,
  118. notion_token,
  119. notion_page_id,
  120. nunux_keeper_enabled,
  121. nunux_keeper_url,
  122. nunux_keeper_api_key,
  123. espial_enabled,
  124. espial_url,
  125. espial_api_key,
  126. espial_tags,
  127. readwise_enabled,
  128. readwise_api_key,
  129. telegram_bot_enabled,
  130. telegram_bot_token,
  131. telegram_bot_chat_id,
  132. telegram_bot_topic_id,
  133. telegram_bot_disable_web_page_preview,
  134. telegram_bot_disable_notification,
  135. telegram_bot_disable_buttons,
  136. linkace_enabled,
  137. linkace_url,
  138. linkace_api_key,
  139. linkace_tags,
  140. linkace_is_private,
  141. linkace_check_disabled,
  142. linkding_enabled,
  143. linkding_url,
  144. linkding_api_key,
  145. linkding_tags,
  146. linkding_mark_as_unread,
  147. linkwarden_enabled,
  148. linkwarden_url,
  149. linkwarden_api_key,
  150. matrix_bot_enabled,
  151. matrix_bot_user,
  152. matrix_bot_password,
  153. matrix_bot_url,
  154. matrix_bot_chat_id,
  155. apprise_enabled,
  156. apprise_url,
  157. apprise_services_url,
  158. readeck_enabled,
  159. readeck_url,
  160. readeck_api_key,
  161. readeck_labels,
  162. readeck_only_url,
  163. shiori_enabled,
  164. shiori_url,
  165. shiori_username,
  166. shiori_password,
  167. shaarli_enabled,
  168. shaarli_url,
  169. shaarli_api_secret,
  170. webhook_enabled,
  171. webhook_url,
  172. webhook_secret,
  173. rssbridge_enabled,
  174. rssbridge_url,
  175. omnivore_enabled,
  176. omnivore_api_key,
  177. omnivore_url,
  178. raindrop_enabled,
  179. raindrop_token,
  180. raindrop_collection_id,
  181. raindrop_tags,
  182. betula_enabled,
  183. betula_url,
  184. betula_token,
  185. ntfy_enabled,
  186. ntfy_topic,
  187. ntfy_url,
  188. ntfy_api_token,
  189. ntfy_username,
  190. ntfy_password,
  191. ntfy_icon_url,
  192. ntfy_internal_links,
  193. cubox_enabled,
  194. cubox_api_link,
  195. discord_enabled,
  196. discord_webhook_link,
  197. slack_enabled,
  198. slack_webhook_link,
  199. pushover_enabled,
  200. pushover_user,
  201. pushover_token,
  202. pushover_device,
  203. pushover_prefix,
  204. rssbridge_token,
  205. karakeep_enabled,
  206. karakeep_api_key,
  207. karakeep_url,
  208. karakeep_tags,
  209. linktaco_enabled,
  210. linktaco_api_token,
  211. linktaco_org_slug,
  212. linktaco_tags,
  213. linktaco_visibility,
  214. archiveorg_enabled
  215. FROM
  216. integrations
  217. WHERE
  218. user_id=$1
  219. `
  220. var integration model.Integration
  221. err := s.db.QueryRow(query, userID).Scan(
  222. &integration.UserID,
  223. &integration.PinboardEnabled,
  224. &integration.PinboardToken,
  225. &integration.PinboardTags,
  226. &integration.PinboardMarkAsUnread,
  227. &integration.InstapaperEnabled,
  228. &integration.InstapaperUsername,
  229. &integration.InstapaperPassword,
  230. &integration.FeverEnabled,
  231. &integration.FeverUsername,
  232. &integration.FeverToken,
  233. &integration.GoogleReaderEnabled,
  234. &integration.GoogleReaderUsername,
  235. &integration.GoogleReaderPassword,
  236. &integration.WallabagEnabled,
  237. &integration.WallabagOnlyURL,
  238. &integration.WallabagURL,
  239. &integration.WallabagClientID,
  240. &integration.WallabagClientSecret,
  241. &integration.WallabagUsername,
  242. &integration.WallabagPassword,
  243. &integration.WallabagTags,
  244. &integration.NotionEnabled,
  245. &integration.NotionToken,
  246. &integration.NotionPageID,
  247. &integration.NunuxKeeperEnabled,
  248. &integration.NunuxKeeperURL,
  249. &integration.NunuxKeeperAPIKey,
  250. &integration.EspialEnabled,
  251. &integration.EspialURL,
  252. &integration.EspialAPIKey,
  253. &integration.EspialTags,
  254. &integration.ReadwiseEnabled,
  255. &integration.ReadwiseAPIKey,
  256. &integration.TelegramBotEnabled,
  257. &integration.TelegramBotToken,
  258. &integration.TelegramBotChatID,
  259. &integration.TelegramBotTopicID,
  260. &integration.TelegramBotDisableWebPagePreview,
  261. &integration.TelegramBotDisableNotification,
  262. &integration.TelegramBotDisableButtons,
  263. &integration.LinkAceEnabled,
  264. &integration.LinkAceURL,
  265. &integration.LinkAceAPIKey,
  266. &integration.LinkAceTags,
  267. &integration.LinkAcePrivate,
  268. &integration.LinkAceCheckDisabled,
  269. &integration.LinkdingEnabled,
  270. &integration.LinkdingURL,
  271. &integration.LinkdingAPIKey,
  272. &integration.LinkdingTags,
  273. &integration.LinkdingMarkAsUnread,
  274. &integration.LinkwardenEnabled,
  275. &integration.LinkwardenURL,
  276. &integration.LinkwardenAPIKey,
  277. &integration.MatrixBotEnabled,
  278. &integration.MatrixBotUser,
  279. &integration.MatrixBotPassword,
  280. &integration.MatrixBotURL,
  281. &integration.MatrixBotChatID,
  282. &integration.AppriseEnabled,
  283. &integration.AppriseURL,
  284. &integration.AppriseServicesURL,
  285. &integration.ReadeckEnabled,
  286. &integration.ReadeckURL,
  287. &integration.ReadeckAPIKey,
  288. &integration.ReadeckLabels,
  289. &integration.ReadeckOnlyURL,
  290. &integration.ShioriEnabled,
  291. &integration.ShioriURL,
  292. &integration.ShioriUsername,
  293. &integration.ShioriPassword,
  294. &integration.ShaarliEnabled,
  295. &integration.ShaarliURL,
  296. &integration.ShaarliAPISecret,
  297. &integration.WebhookEnabled,
  298. &integration.WebhookURL,
  299. &integration.WebhookSecret,
  300. &integration.RSSBridgeEnabled,
  301. &integration.RSSBridgeURL,
  302. &integration.OmnivoreEnabled,
  303. &integration.OmnivoreAPIKey,
  304. &integration.OmnivoreURL,
  305. &integration.RaindropEnabled,
  306. &integration.RaindropToken,
  307. &integration.RaindropCollectionID,
  308. &integration.RaindropTags,
  309. &integration.BetulaEnabled,
  310. &integration.BetulaURL,
  311. &integration.BetulaToken,
  312. &integration.NtfyEnabled,
  313. &integration.NtfyTopic,
  314. &integration.NtfyURL,
  315. &integration.NtfyAPIToken,
  316. &integration.NtfyUsername,
  317. &integration.NtfyPassword,
  318. &integration.NtfyIconURL,
  319. &integration.NtfyInternalLinks,
  320. &integration.CuboxEnabled,
  321. &integration.CuboxAPILink,
  322. &integration.DiscordEnabled,
  323. &integration.DiscordWebhookLink,
  324. &integration.SlackEnabled,
  325. &integration.SlackWebhookLink,
  326. &integration.PushoverEnabled,
  327. &integration.PushoverUser,
  328. &integration.PushoverToken,
  329. &integration.PushoverDevice,
  330. &integration.PushoverPrefix,
  331. &integration.RSSBridgeToken,
  332. &integration.KarakeepEnabled,
  333. &integration.KarakeepAPIKey,
  334. &integration.KarakeepURL,
  335. &integration.KarakeepTags,
  336. &integration.LinktacoEnabled,
  337. &integration.LinktacoAPIToken,
  338. &integration.LinktacoOrgSlug,
  339. &integration.LinktacoTags,
  340. &integration.LinktacoVisibility,
  341. &integration.ArchiveorgEnabled,
  342. )
  343. switch {
  344. case err == sql.ErrNoRows:
  345. return &integration, nil
  346. case err != nil:
  347. return &integration, fmt.Errorf(`store: unable to fetch integration row: %v`, err)
  348. default:
  349. return &integration, nil
  350. }
  351. }
  352. // UpdateIntegration saves user integration settings.
  353. func (s *Storage) UpdateIntegration(integration *model.Integration) error {
  354. query := `
  355. UPDATE
  356. integrations
  357. SET
  358. pinboard_enabled=$1,
  359. pinboard_token=$2,
  360. pinboard_tags=$3,
  361. pinboard_mark_as_unread=$4,
  362. instapaper_enabled=$5,
  363. instapaper_username=$6,
  364. instapaper_password=$7,
  365. fever_enabled=$8,
  366. fever_username=$9,
  367. fever_token=$10,
  368. wallabag_enabled=$11,
  369. wallabag_only_url=$12,
  370. wallabag_url=$13,
  371. wallabag_client_id=$14,
  372. wallabag_client_secret=$15,
  373. wallabag_username=$16,
  374. wallabag_password=$17,
  375. wallabag_tags=$18,
  376. nunux_keeper_enabled=$19,
  377. nunux_keeper_url=$20,
  378. nunux_keeper_api_key=$21,
  379. googlereader_enabled=$22,
  380. googlereader_username=$23,
  381. googlereader_password=$24,
  382. telegram_bot_enabled=$25,
  383. telegram_bot_token=$26,
  384. telegram_bot_chat_id=$27,
  385. telegram_bot_topic_id=$28,
  386. telegram_bot_disable_web_page_preview=$29,
  387. telegram_bot_disable_notification=$30,
  388. telegram_bot_disable_buttons=$31,
  389. espial_enabled=$32,
  390. espial_url=$33,
  391. espial_api_key=$34,
  392. espial_tags=$35,
  393. linkace_enabled=$36,
  394. linkace_url=$37,
  395. linkace_api_key=$38,
  396. linkace_tags=$39,
  397. linkace_is_private=$40,
  398. linkace_check_disabled=$41,
  399. linkding_enabled=$42,
  400. linkding_url=$43,
  401. linkding_api_key=$44,
  402. linkding_tags=$45,
  403. linkding_mark_as_unread=$46,
  404. matrix_bot_enabled=$47,
  405. matrix_bot_user=$48,
  406. matrix_bot_password=$49,
  407. matrix_bot_url=$50,
  408. matrix_bot_chat_id=$51,
  409. notion_enabled=$52,
  410. notion_token=$53,
  411. notion_page_id=$54,
  412. readwise_enabled=$55,
  413. readwise_api_key=$56,
  414. apprise_enabled=$57,
  415. apprise_url=$58,
  416. apprise_services_url=$59,
  417. readeck_enabled=$60,
  418. readeck_url=$61,
  419. readeck_api_key=$62,
  420. readeck_labels=$63,
  421. readeck_only_url=$64,
  422. shiori_enabled=$65,
  423. shiori_url=$66,
  424. shiori_username=$67,
  425. shiori_password=$68,
  426. shaarli_enabled=$69,
  427. shaarli_url=$70,
  428. shaarli_api_secret=$71,
  429. webhook_enabled=$72,
  430. webhook_url=$73,
  431. webhook_secret=$74,
  432. rssbridge_enabled=$75,
  433. rssbridge_url=$76,
  434. omnivore_enabled=$77,
  435. omnivore_api_key=$78,
  436. omnivore_url=$79,
  437. linkwarden_enabled=$80,
  438. linkwarden_url=$81,
  439. linkwarden_api_key=$82,
  440. raindrop_enabled=$83,
  441. raindrop_token=$84,
  442. raindrop_collection_id=$85,
  443. raindrop_tags=$86,
  444. betula_enabled=$87,
  445. betula_url=$88,
  446. betula_token=$89,
  447. ntfy_enabled=$90,
  448. ntfy_topic=$91,
  449. ntfy_url=$92,
  450. ntfy_api_token=$93,
  451. ntfy_username=$94,
  452. ntfy_password=$95,
  453. ntfy_icon_url=$96,
  454. ntfy_internal_links=$97,
  455. cubox_enabled=$98,
  456. cubox_api_link=$99,
  457. discord_enabled=$100,
  458. discord_webhook_link=$101,
  459. slack_enabled=$102,
  460. slack_webhook_link=$103,
  461. pushover_enabled=$104,
  462. pushover_user=$105,
  463. pushover_token=$106,
  464. pushover_device=$107,
  465. pushover_prefix=$108,
  466. rssbridge_token=$109,
  467. karakeep_enabled=$110,
  468. karakeep_api_key=$111,
  469. karakeep_url=$112,
  470. karakeep_tags=$113,
  471. linktaco_enabled=$114,
  472. linktaco_api_token=$115,
  473. linktaco_org_slug=$116,
  474. linktaco_tags=$117,
  475. linktaco_visibility=$118,
  476. archiveorg_enabled=$119
  477. WHERE
  478. user_id=$120
  479. `
  480. _, err := s.db.Exec(
  481. query,
  482. integration.PinboardEnabled,
  483. integration.PinboardToken,
  484. integration.PinboardTags,
  485. integration.PinboardMarkAsUnread,
  486. integration.InstapaperEnabled,
  487. integration.InstapaperUsername,
  488. integration.InstapaperPassword,
  489. integration.FeverEnabled,
  490. integration.FeverUsername,
  491. integration.FeverToken,
  492. integration.WallabagEnabled,
  493. integration.WallabagOnlyURL,
  494. integration.WallabagURL,
  495. integration.WallabagClientID,
  496. integration.WallabagClientSecret,
  497. integration.WallabagUsername,
  498. integration.WallabagPassword,
  499. integration.WallabagTags,
  500. integration.NunuxKeeperEnabled,
  501. integration.NunuxKeeperURL,
  502. integration.NunuxKeeperAPIKey,
  503. integration.GoogleReaderEnabled,
  504. integration.GoogleReaderUsername,
  505. integration.GoogleReaderPassword,
  506. integration.TelegramBotEnabled,
  507. integration.TelegramBotToken,
  508. integration.TelegramBotChatID,
  509. integration.TelegramBotTopicID,
  510. integration.TelegramBotDisableWebPagePreview,
  511. integration.TelegramBotDisableNotification,
  512. integration.TelegramBotDisableButtons,
  513. integration.EspialEnabled,
  514. integration.EspialURL,
  515. integration.EspialAPIKey,
  516. integration.EspialTags,
  517. integration.LinkAceEnabled,
  518. integration.LinkAceURL,
  519. integration.LinkAceAPIKey,
  520. integration.LinkAceTags,
  521. integration.LinkAcePrivate,
  522. integration.LinkAceCheckDisabled,
  523. integration.LinkdingEnabled,
  524. integration.LinkdingURL,
  525. integration.LinkdingAPIKey,
  526. integration.LinkdingTags,
  527. integration.LinkdingMarkAsUnread,
  528. integration.MatrixBotEnabled,
  529. integration.MatrixBotUser,
  530. integration.MatrixBotPassword,
  531. integration.MatrixBotURL,
  532. integration.MatrixBotChatID,
  533. integration.NotionEnabled,
  534. integration.NotionToken,
  535. integration.NotionPageID,
  536. integration.ReadwiseEnabled,
  537. integration.ReadwiseAPIKey,
  538. integration.AppriseEnabled,
  539. integration.AppriseURL,
  540. integration.AppriseServicesURL,
  541. integration.ReadeckEnabled,
  542. integration.ReadeckURL,
  543. integration.ReadeckAPIKey,
  544. integration.ReadeckLabels,
  545. integration.ReadeckOnlyURL,
  546. integration.ShioriEnabled,
  547. integration.ShioriURL,
  548. integration.ShioriUsername,
  549. integration.ShioriPassword,
  550. integration.ShaarliEnabled,
  551. integration.ShaarliURL,
  552. integration.ShaarliAPISecret,
  553. integration.WebhookEnabled,
  554. integration.WebhookURL,
  555. integration.WebhookSecret,
  556. integration.RSSBridgeEnabled,
  557. integration.RSSBridgeURL,
  558. integration.OmnivoreEnabled,
  559. integration.OmnivoreAPIKey,
  560. integration.OmnivoreURL,
  561. integration.LinkwardenEnabled,
  562. integration.LinkwardenURL,
  563. integration.LinkwardenAPIKey,
  564. integration.RaindropEnabled,
  565. integration.RaindropToken,
  566. integration.RaindropCollectionID,
  567. integration.RaindropTags,
  568. integration.BetulaEnabled,
  569. integration.BetulaURL,
  570. integration.BetulaToken,
  571. integration.NtfyEnabled,
  572. integration.NtfyTopic,
  573. integration.NtfyURL,
  574. integration.NtfyAPIToken,
  575. integration.NtfyUsername,
  576. integration.NtfyPassword,
  577. integration.NtfyIconURL,
  578. integration.NtfyInternalLinks,
  579. integration.CuboxEnabled,
  580. integration.CuboxAPILink,
  581. integration.DiscordEnabled,
  582. integration.DiscordWebhookLink,
  583. integration.SlackEnabled,
  584. integration.SlackWebhookLink,
  585. integration.PushoverEnabled,
  586. integration.PushoverUser,
  587. integration.PushoverToken,
  588. integration.PushoverDevice,
  589. integration.PushoverPrefix,
  590. integration.RSSBridgeToken,
  591. integration.KarakeepEnabled,
  592. integration.KarakeepAPIKey,
  593. integration.KarakeepURL,
  594. integration.KarakeepTags,
  595. integration.LinktacoEnabled,
  596. integration.LinktacoAPIToken,
  597. integration.LinktacoOrgSlug,
  598. integration.LinktacoTags,
  599. integration.LinktacoVisibility,
  600. integration.ArchiveorgEnabled,
  601. integration.UserID,
  602. )
  603. if err != nil {
  604. return fmt.Errorf(`store: unable to update integration record: %v`, err)
  605. }
  606. return nil
  607. }
  608. // HasSaveEntry returns true if the given user can save articles to third-parties.
  609. func (s *Storage) HasSaveEntry(userID int64) (result bool) {
  610. query := `
  611. SELECT
  612. true
  613. FROM
  614. integrations
  615. WHERE
  616. user_id=$1
  617. AND
  618. (
  619. pinboard_enabled='t' OR
  620. instapaper_enabled='t' OR
  621. wallabag_enabled='t' OR
  622. notion_enabled='t' OR
  623. nunux_keeper_enabled='t' OR
  624. espial_enabled='t' OR
  625. readwise_enabled='t' OR
  626. linkace_enabled='t' OR
  627. linkding_enabled='t' OR
  628. linktaco_enabled='t' OR
  629. linkwarden_enabled='t' OR
  630. apprise_enabled='t' OR
  631. shiori_enabled='t' OR
  632. readeck_enabled='t' OR
  633. shaarli_enabled='t' OR
  634. webhook_enabled='t' OR
  635. omnivore_enabled='t' OR
  636. karakeep_enabled='t' OR
  637. raindrop_enabled='t' OR
  638. betula_enabled='t' OR
  639. cubox_enabled='t' OR
  640. discord_enabled='t' OR
  641. slack_enabled='t' OR
  642. archiveorg_enabled='t'
  643. )
  644. `
  645. if err := s.db.QueryRow(query, userID).Scan(&result); err != nil {
  646. result = false
  647. }
  648. return result
  649. }