Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
Kyclos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
Kyclos
Commits
1f5e7639
Verified
Commit
1f5e7639
authored
Jan 23, 2020
by
Haelwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worker.js: Fix some formatting
parent
c52715ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
46 deletions
+55
-46
qml/lib/Worker.js
qml/lib/Worker.js
+55
-46
No files found.
qml/lib/Worker.js
View file @
1f5e7639
...
...
@@ -23,11 +23,11 @@ WorkerScript.onMessage =
console
.
log
(
"
Not loggedin
"
)
return
;
}
if
(
typeof
msg
.
conf
[
'
loadImages
'
]
!==
"
undefined
"
)
loadImages
=
msg
.
conf
[
'
loadImages
'
]
var
API
=
MastodonAPI
({
instance
:
msg
.
conf
.
instance
,
api_user_token
:
msg
.
conf
.
api_user_token
});
if
(
typeof
msg
.
conf
[
'
loadImages
'
]
!==
"
undefined
"
)
loadImages
=
msg
.
conf
[
'
loadImages
'
];
var
API
=
MastodonAPI
({
instance
:
msg
.
conf
.
instance
,
api_user_token
:
msg
.
conf
.
api_user_token
});
if
(
msg
.
method
===
"
POST
"
)
{
API
.
post
(
msg
.
action
,
msg
.
params
,
function
(
data
)
{
...
...
@@ -105,8 +105,8 @@ WorkerScript.onMessage =
console
.
log
(
"
descendants
"
)
for
(
var
j
=
0
;
j
<
data
[
i
].
length
;
j
++
)
{
item
=
parseToot
(
data
[
i
][
j
]);
item
[
'
id
'
]
=
item
[
'
status_id
'
];
item
=
parseToot
(
data
[
i
][
j
]);
item
[
'
id
'
]
=
item
[
'
status_id
'
];
if
(
typeof
item
[
'
attachments
'
]
===
"
undefined
"
)
item
[
'
attachments
'
]
=
[];
items
.
push
(
item
)
console
.
log
(
JSON
.
stringify
(
data
[
i
][
j
]))
...
...
@@ -163,7 +163,7 @@ function addDataToModel(model, mode, items) {
res
[
prefix
+
'
account_created_at
'
]
=
data
[
"
created_at
"
]
res
[
prefix
+
'
account_avatar
'
]
=
data
[
"
avatar
"
]
//
/
console.log(JSON.stringify(res))
// console.log(JSON.stringify(res))
return
(
res
);
}
...
...
@@ -184,7 +184,7 @@ function parseNotification(data) {
item
=
parseAccounts
(
item
,
""
,
data
[
"
status
"
][
"
account
"
])
item
[
'
status_reblog
'
]
=
true
;
item
[
'
type
'
]
=
"
reblog
"
;
item
[
'
typeIcon
'
]
=
"
image://theme/icon-s-retweet
"
item
[
'
typeIcon
'
]
=
"
image://theme/icon-s-retweet
"
;
break
;
case
"
favourite
"
:
item
=
parseToot
(
data
.
status
)
...
...
@@ -197,13 +197,12 @@ function parseNotification(data) {
break
;
case
"
follow
"
:
item
[
'
type
'
]
=
"
follow
"
;
item
=
parseAccounts
(
item
,
""
,
data
[
"
account
"
])
item
=
parseAccounts
(
item
,
"
reblog_
"
,
data
[
"
account
"
])
item
[
'
content
'
]
=
data
[
'
account
'
][
'
note
'
]
item
[
'
typeIcon
'
]
=
"
image://theme/icon-s-installed
"
item
[
'
attachments
'
]
=
[]
break
;
item
=
parseAccounts
(
item
,
""
,
data
[
"
account
"
]);
item
=
parseAccounts
(
item
,
"
reblog_
"
,
data
[
"
account
"
]);
item
[
'
content
'
]
=
data
[
'
account
'
][
'
note
'
];
item
[
'
typeIcon
'
]
=
"
image://theme/icon-s-installed
"
;
item
[
'
attachments
'
]
=
[];
break
;
default
:
item
[
'
typeIcon
'
]
=
"
image://theme/icon-s-sailfish
"
}
...
...
@@ -228,10 +227,14 @@ collect() {
}
}
return
ret
;
}
function
getDate
(
dateStr
)
{
}
function
getDate
(
dateStr
)
{
var
ts
=
new
Date
(
dateStr
);
return
new
Date
(
ts
.
getFullYear
(),
ts
.
getMonth
(),
ts
.
getDate
(),
0
,
0
,
0
)
}
function
parseToot
(
data
)
{
}
function
parseToot
(
data
)
{
var
i
=
0
;
var
item
=
{};
...
...
@@ -243,15 +246,17 @@ collect() {
item
[
'
status_in_reply_to_account_id
'
]
=
data
[
"
in_reply_to_account_id
"
]
item
[
'
status_reblog
'
]
=
data
[
"
reblog
"
]
?
true
:
false
item
[
'
status_content
'
]
=
data
[
"
content
"
]
item
[
'
status_created_at
'
]
=
item
[
'
created_at
'
]
=
new
Date
(
data
[
"
created_at
"
]);
item
[
'
section
'
]
=
getDate
(
data
[
"
created_at
"
]);
item
[
'
reblogs_count
'
]
=
data
[
"
reblogs_count
"
]
item
[
'
favourites_count
'
]
=
data
[
"
favourites_count
"
]
item
[
'
reblogged
'
]
=
data
[
"
reblogged
"
]
item
[
'
favourited
'
]
=
data
[
"
favourited
"
]
item
[
'
status_sensitive
'
]
=
data
[
"
sensitive
"
]
item
[
'
status_spoiler_text
'
]
=
data
[
"
spoiler_text
"
]
item
[
'
status_visibility
'
]
=
data
[
"
visibility
"
]
item
[
'
section
'
]
=
getDate
(
data
[
"
created_at
"
]);
item
[
'
reblogs_count
'
]
=
data
[
"
reblogs_count
"
]
item
[
'
favourites_count
'
]
=
data
[
"
favourites_count
"
]
item
[
'
reblogged
'
]
=
data
[
"
reblogged
"
]
item
[
'
favourited
'
]
=
data
[
"
favourited
"
]
item
[
'
status_sensitive
'
]
=
data
[
"
sensitive
"
]
item
[
'
status_spoiler_text
'
]
=
data
[
"
spoiler_text
"
]
item
[
'
status_visibility
'
]
=
data
[
"
visibility
"
]
if
(
item
[
'
status_reblog
'
])
{
...
...
@@ -264,42 +269,46 @@ collect() {
item
=
parseAccounts
(
item
,
""
,
data
[
'
reblog
'
][
"
account
"
])
item
=
parseAccounts
(
item
,
"
reblog_
"
,
data
[
"
account
"
])
}
else
{
item
=
parseAccounts
(
item
,
""
,
data
[
"
account
"
])}
item
[
'
content
'
]
=
data
[
'
content
'
]
.
replaceAll
(
'
</span><span class="invisible">
'
,
''
)
.
replaceAll
(
'
<span class="invisible">
'
,
''
)
.
replaceAll
(
'
</span><span class="ellipsis">
'
,
''
)
.
replaceAll
(
'
class=""
'
,
''
);
else
{
item
=
parseAccounts
(
item
,
""
,
data
[
"
account
"
])}
item
[
'
content
'
]
=
data
[
'
content
'
]
.
replaceAll
(
'
</span><span class="invisible">
'
,
''
)
.
replaceAll
(
'
<span class="invisible">
'
,
''
)
.
replaceAll
(
'
</span><span class="ellipsis">
'
,
''
)
.
replaceAll
(
'
class=""
'
,
''
);
item
[
'
attachments
'
]
=
[];
for
(
i
=
0
;
i
<
data
[
'
media_attachments
'
].
length
;
i
++
)
{
var
attachments
=
data
[
'
media_attachments
'
][
i
];
item
[
'
content
'
]
=
item
[
'
content
'
].
replaceAll
(
attachments
[
'
text_url
'
],
''
)
var
tmp
=
{
id
:
attachments
[
'
id
'
],
id
:
attachments
[
'
id
'
],
type
:
attachments
[
'
type
'
],
url
:
attachments
[
'
remote_url
'
]
&&
typeof
attachments
[
'
remote_url
'
]
==
"
string
"
?
attachments
[
'
remote_url
'
]
:
attachments
[
'
url
'
],
preview_url
:
loadImages
?
attachments
[
'
preview_url
'
]
:
''
var
tmp
=
{
id
:
attachments
[
'
id
'
],
id
:
attachments
[
'
id
'
],
type
:
attachments
[
'
type
'
],
url
:
attachments
[
'
remote_url
'
]
&&
typeof
attachments
[
'
remote_url
'
]
==
"
string
"
?
attachments
[
'
remote_url
'
]
:
attachments
[
'
url
'
],
preview_url
:
loadImages
?
attachments
[
'
preview_url
'
]
:
''
}
item
[
'
attachments
'
]
.
push
(
tmp
)
}
if
(
item
[
'
status_reblog
'
])
{
for
(
i
=
0
;
i
<
data
[
'
reblog
'
][
'
media_attachments
'
].
length
;
i
++
)
{
var
attachments
=
data
[
'
reblog
'
][
'
media_attachments
'
][
i
];
item
[
'
content
'
]
=
item
[
'
content
'
].
replaceAll
(
attachments
[
'
text_url
'
],
''
)
var
tmp
=
{
id
:
attachments
[
'
id
'
],
type
:
attachments
[
'
type
'
],
url
:
attachments
[
'
remote_url
'
]
&&
typeof
attachments
[
'
remote_url
'
]
==
"
string
"
?
attachments
[
'
remote_url
'
]
:
attachments
[
'
url
'
],
preview_url
:
loadImages
?
attachments
[
'
preview_url
'
]
:
''
var
tmp
=
{
id
:
attachments
[
'
id
'
],
type
:
attachments
[
'
type
'
],
url
:
attachments
[
'
remote_url
'
]
&&
typeof
attachments
[
'
remote_url
'
]
==
"
string
"
?
attachments
[
'
remote_url
'
]
:
attachments
[
'
url
'
],
preview_url
:
loadImages
?
attachments
[
'
preview_url
'
]
:
''
}
item
[
'
attachments
'
]
.
push
(
tmp
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment