Compare commits

..

2 Commits

Author SHA1 Message Date
337acb5448 mstodo query 2020-10-11 20:18:09 +02:00
e019d5660b added mstodo as wunderlist, gitbase as gitlab 2020-10-04 03:14:41 +02:00
7 changed files with 48 additions and 49 deletions

View File

@ -47,7 +47,7 @@
"copy-webpack-plugin": "^6.0.2",
"copyfiles": "^2.3.0",
"css-loader": "^4.2.0",
"eslint": "7.10.0",
"eslint": "7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-prettier": "^3.1.3",

View File

@ -1,11 +1,11 @@
import axios from "axios"
import { formatDate } from "utils"
const baseURL = subdomain => {
const baseURL = (subdomain) => {
if (process.env.NODE_ENV === "production") {
return `https://${encodeURIComponent(subdomain)}.mocoapp.com/api/browser_extensions`
} else {
return `http://${encodeURIComponent(subdomain)}.mocoapp.localhost:3000/api/browser_extensions`
return `https://${encodeURIComponent(subdomain)}.mocoapp.com/api/browser_extensions`
}
}
@ -27,7 +27,7 @@ export default class Client {
})
}
login = service =>
login = (service) =>
this.#client.post("session", {
api_key: this.#apiKey,
remote_service: service?.name,
@ -46,7 +46,7 @@ export default class Client {
params: { date: `${formatDate(fromDate)}:${formatDate(toDate)}` },
})
activitiesStatus = service => {
activitiesStatus = (service) => {
if (!service) {
return Promise.resolve({ data: { hours: 0 } })
}
@ -55,7 +55,7 @@ export default class Client {
})
}
createActivity = activity => this.#client.post("activities", { activity })
createActivity = (activity) => this.#client.post("activities", { activity })
stopTimer = timedActivity => this.#client.get(`activities/${timedActivity.id}/stop_timer`)
stopTimer = (timedActivity) => this.#client.get(`activities/${timedActivity.id}/stop_timer`)
}

View File

@ -122,18 +122,31 @@ export default {
allowHostOverride: false,
},
wunderlist: {
mstodo: {
name: "wunderlist",
host: "https://www.wunderlist.com",
urlPatterns: [":host:/(webapp)#/tasks/:id(/*)"],
host: "https://to-do.office.com",
urlPatterns: [":host:/tasks/id/:id(*)"],
description: (document) =>
document
.querySelector(".taskItem.selected .taskItem-titleWrapper-title")
?.textContent?.trim(),
projectId: projectIdentifierBySelector(".taskItem.selected .taskItem-titleWrapper-title"),
.querySelector(".detailHeader")
?.textContent?.replace(/^[^[]+\[/, "[")
.replace(projectRegex, "")
.trim(),
projectId: projectIdentifierBySelector(".detailHeader"),
allowHostOverride: false,
},
gitbase: {
name: "gitlab",
host: "https://gitbase.de",
urlPatterns: [":host:/:owner/:repo/issues/:id"],
description: (document) =>
document.querySelector("#issue-title")?.textContent?.replace(projectRegex, "").trim(),
projectId: projectIdentifierBySelector(".select-project.list a"),
allowHostOverride: false,
},
/*
"gitlab-mr": {
name: "gitlab",
host: "https://gitlab.com",
@ -161,6 +174,7 @@ export default {
},
allowHostOverride: true,
},
*/
monday: {
name: "monday",

View File

@ -28,6 +28,8 @@ export function tabUpdated(tab, { messenger, settings }) {
const service = matcher(tab.url)
const apiClient = new ApiClient(settings)
// console.log(service)
if (service?.match?.id) {
messenger.postMessage(tab, { type: "requestService" })
@ -67,7 +69,7 @@ export function settingsChanged(settings, { messenger }) {
queryTabs({ currentWindow: true })
.then(reject(isBrowserTab))
.then(
forEach(tab => {
forEach((tab) => {
messenger.postMessage(tab, { type: "closePopup" })
tabUpdated(tab, { settings, messenger })
}),
@ -75,7 +77,7 @@ export function settingsChanged(settings, { messenger }) {
}
export function togglePopup(tab, { messenger }) {
return function({ isOpen, service } = {}) {
return function ({ isOpen, service } = {}) {
if (isNil(isOpen)) {
return
}

View File

@ -20,7 +20,7 @@ module.exports = (env) => {
...manifest,
permissions: compact([
...manifest.permissions,
env.NODE_ENV === "development" ? "http://*.mocoapp.localhost/*" : null,
env.NODE_ENV === "development" ? "https://*.mocoapp.com/*" : null,
]),
options_ui: {
...manifest.options_ui,

View File

@ -21,7 +21,7 @@ module.exports = (env) => {
...manifest,
permissions: compact([
...manifest.permissions,
env.NODE_ENV === "development" ? "http://*.mocoapp.localhost/*" : null,
env.NODE_ENV === "development" ? "https://*.mocoapp.com/*" : null,
]),
options_ui: {
...manifest.options_ui,

View File

@ -1043,22 +1043,6 @@
resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46"
integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==
"@eslint/eslintrc@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.1.3.tgz#7d1a2b2358552cc04834c0979bd4275362e37085"
integrity sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
espree "^7.3.0"
globals "^12.1.0"
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
lodash "^4.17.19"
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
@ -3361,12 +3345,12 @@ eslint-scope@^4.0.3:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-scope@^5.0.0, eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==
eslint-scope@^5.0.0, eslint-scope@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5"
integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==
dependencies:
esrecurse "^4.3.0"
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-utils@^2.0.0, eslint-utils@^2.1.0:
@ -3381,23 +3365,22 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint@7.10.0:
version "7.10.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.10.0.tgz#494edb3e4750fb791133ca379e786a8f648c72b9"
integrity sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==
eslint@7.6.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.6.0.tgz#522d67cfaea09724d96949c70e7a0550614d64d6"
integrity sha512-QlAManNtqr7sozWm5TF4wIH9gmUm2hE3vNRUvyoYAa4y1l5/jxD/PQStEjBMQtCqZmSep8UxrcecI60hOpe61w==
dependencies:
"@babel/code-frame" "^7.0.0"
"@eslint/eslintrc" "^0.1.3"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
debug "^4.0.1"
doctrine "^3.0.0"
enquirer "^2.3.5"
eslint-scope "^5.1.1"
eslint-scope "^5.1.0"
eslint-utils "^2.1.0"
eslint-visitor-keys "^1.3.0"
espree "^7.3.0"
espree "^7.2.0"
esquery "^1.2.0"
esutils "^2.0.2"
file-entry-cache "^5.0.1"
@ -3424,7 +3407,7 @@ eslint@7.10.0:
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
espree@^7.3.0:
espree@^7.2.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348"
integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==
@ -3445,7 +3428,7 @@ esquery@^1.2.0:
dependencies:
estraverse "^5.1.0"
esrecurse@^4.1.0, esrecurse@^4.3.0:
esrecurse@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921"
integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==
@ -4279,7 +4262,7 @@ ignore@^5.1.4:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1:
import-fresh@^3.0.0, import-fresh@^3.1.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==
@ -7618,7 +7601,7 @@ strip-indent@^1.0.1:
dependencies:
get-stdin "^4.0.1"
strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
strip-json-comments@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==