Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
339
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
25
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
3d794980
Commit
3d794980
authored
7 years ago
by
syuilo⭐️
Browse files
Options
Downloads
Patches
Plain Diff
Update boot.js
parent
f52dbbf2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/web/app/boot.js
+22
-11
22 additions, 11 deletions
src/web/app/boot.js
with
22 additions
and
11 deletions
src/web/app/boot.js
+
22
−
11
View file @
3d794980
/**
* boot
* boot
loader
*/
"
use strict
"
;
import
*
as
riot
from
'
riot
'
;
import
api
from
'
./common/scripts/api
'
;
import
signout
from
'
./common/scripts/signout
'
;
...
...
@@ -15,16 +17,12 @@ require('./common/tags');
* MISSKEY ENTRY POINT!
*/
"
use strict
"
;
console
.
info
(
`Misskey v
${
VERSION
}
`
);
document
.
domain
=
CONFIG
.
host
;
// Set global configuration
riot
.
mixin
({
CONFIG
});
riot
.
mixin
({
CONFIG
});
// ↓ NodeList、HTMLCollection、FileList、DataTransferItemListで forEach を使えるようにする
if
(
NodeList
.
prototype
.
forEach
===
undefined
)
{
...
...
@@ -40,7 +38,7 @@ if (window.DataTransferItemList && DataTransferItemList.prototype.forEach === un
DataTransferItemList
.
prototype
.
forEach
=
Array
.
prototype
.
forEach
;
}
//
↓
iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする
// iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする
try
{
localStorage
.
setItem
(
'
kyoppie
'
,
'
yuppie
'
);
}
catch
(
e
)
{
...
...
@@ -76,15 +74,18 @@ export default callback => {
fetchme
(
i
,
fetched
);
}
// フェッチが完了したとき
function
fetched
(
me
)
{
if
(
me
)
{
riot
.
observable
(
me
);
// この me オブジェクトを更新するメソッド
me
.
update
=
data
=>
{
if
(
data
)
Object
.
assign
(
me
,
data
);
me
.
trigger
(
'
updated
'
);
};
// ローカルストレージにキャッシュ
localStorage
.
setItem
(
'
me
'
,
JSON
.
stringify
(
me
));
me
.
on
(
'
updated
'
,
()
=>
{
...
...
@@ -93,11 +94,14 @@ export default callback => {
});
}
// ミックスイン初期化
mixin
(
me
);
// ローディング画面クリア
const
ini
=
document
.
getElementById
(
'
ini
'
);
ini
.
parentNode
.
removeChild
(
ini
);
// アプリ基底要素マウント
const
app
=
document
.
createElement
(
'
div
'
);
app
.
setAttribute
(
'
id
'
,
'
app
'
);
document
.
body
.
appendChild
(
app
);
...
...
@@ -125,7 +129,7 @@ function fetchme(token, cb) {
body
:
JSON
.
stringify
({
i
:
token
})
}).
then
(
res
=>
{
}).
then
(
res
=>
{
// When success
// When failed to authenticate user
if
(
res
.
status
!==
200
)
{
return
signout
();
...
...
@@ -138,14 +142,17 @@ function fetchme(token, cb) {
// initialize it if user data is empty
me
.
data
?
done
()
:
init
();
});
},
()
=>
{
riot
.
mount
(
document
.
body
.
appendChild
(
document
.
createElement
(
'
mk-error
'
)));
},
()
=>
{
// When failure
// Display error screen
riot
.
mount
(
document
.
body
.
appendChild
(
document
.
createElement
(
'
mk-error
'
)));
});
function
done
()
{
if
(
cb
)
cb
(
me
);
}
// Initialize user data
function
init
()
{
const
data
=
generateDefaultUserdata
();
api
(
token
,
'
i/appdata/set
'
,
{
...
...
@@ -157,8 +164,11 @@ function fetchme(token, cb) {
}
}
// BSoD
function
panic
(
e
)
{
console
.
error
(
e
);
// Display blue screen
document
.
body
.
innerHTML
=
`<div id="error">
<h1>:( 致命的な問題が発生しました。</h1>
...
...
@@ -168,8 +178,9 @@ function panic(e) {
<p>ブラウザ バージョン:
${
navigator
.
userAgent
}
</p>
<p>クライアント バージョン:
${
VERSION
}
</p>
<hr>
<p>問題が解決しない場合は上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。</p>
<p>問題が解決しない場合は
、
上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。</p>
<p>Thank you for using Misskey.</p>
</div>`
;
// TODO: Report the bug
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment