Skip to content

Commit

Permalink
Initial version for Datacenter support
Browse files Browse the repository at this point in the history
  • Loading branch information
skleinei committed Sep 6, 2022
1 parent c820a9e commit 0b8b885
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/confluence-quicksearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def parseArgs():
args = parser.parse_args()

args.textAsString = " ".join(args.text)

args.pathPrefix = ""
args.isDatacenter = True
if re.search("atlassian.net", args.url) or re.search("jira.com", args.url):
args.isDatacenter = False
args.pathPrefix = "/wiki"

return args
Expand Down Expand Up @@ -164,12 +167,20 @@ def getIconPath(result, args):
def getMods(result, args):
mod = {}

if result["content"]["type"] == "blogpost" or result["content"]["type"] == "page":
mod["cmd"] = {
"valid": True,
"arg": args.url + args.pathPrefix + result["content"]["_links"]["editui"],
"subtitle": "Open in editor"
}
if args.isDatacenter == True:
if result["content"]["type"] == "blogpost" or result["content"]["type"] == "page":
mod["cmd"] = {
"valid": True,
"arg": args.url + args.pathPrefix + "/pages/editpage.action?pageId=" + result["content"]["id"],
"subtitle": "Open in editor"
}
else:
if result["content"]["type"] == "blogpost" or result["content"]["type"] == "page":
mod["cmd"] = {
"valid": True,
"arg": args.url + args.pathPrefix + result["content"]["_links"]["editui"],
"subtitle": "Open in editor"
}

return mod

Expand Down

0 comments on commit 0b8b885

Please sign in to comment.