1- <!doctype html>
2- < html lang ="en ">
3- < head >
4- < meta charset ="utf-8 ">
5- < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
6- < title > Welcome to Solid</ title >
1+ <!doctype html> < html > < head >
2+ < meta charset ="utf-8 "/>
73 < link rel ="stylesheet " href ="/common/css/bootstrap.min.css ">
84 < link rel ="stylesheet " href ="/common/css/solid.css ">
9- </ head >
10- < body >
11- < div class ="container ">
12- < div class ="page-header ">
13- < div class ="pull-right ">
14- < button id ="register " type ="button " class ="btn btn-primary "> Register</ button >
15- < button id ="login " type ="button " class ="hidden btn btn-default btn-success "> Log in</ button >
16- < button id ="logout " type ="button " class ="hidden btn btn-danger "> Log out</ button >
17- </ div >
18-
19- < h1 > Welcome to the Solid Prototype</ h1 >
20- </ div >
5+ < script >
6+ var keyname = 'SolidServerRootRedirectLink' ;
7+ function register ( ) { alert ( 2 ) ; window . location . href = "/register" ; }
8+ document . addEventListener ( 'DOMContentLoaded' , async function ( ) {
9+ if ( ! UI . authn . currentUser ( ) ) await UI . authn . checkUser ( ) ;
10+ let user = UI . authn . currentUser ( ) ;
11+
12+ // IF LOGGED IN: SET COOKIE. LOGOUT
13+ //
14+ if ( user ) {
15+ window . localStorage . setItem ( keyname , user . uri ) ;
16+ await UI . authn . authSession . logout ( ) ;
17+ }
18+ else {
19+ let webId = window . localStorage . getItem ( keyname ) ;
20+
21+ // IF NOT LOGGED IN AND COOKIE EXISTS: REMOVE COOKIE, HIDE WELCOME, SHOW LINK TO PROFILE
22+ //
23+ if ( webId ) {
24+ window . localStorage . removeItem ( keyname ) ;
25+ document . getElementById ( 'prototype' ) . style . display = "none" ;
26+ document . getElementById ( 'loggedIn' ) . style . display = "block" ;
27+ document . getElementById ( 'loggedIn' ) . innerHTML = `<p>Your WebID and profile address are</p> <p> <${ webId } >.</p><a href="${ webId } ">Visit your profile to log in.</a></div>` ;
28+ }
29+
30+ // IF NOT LOGGED IN AND COOKIE DOES NOT EXIST
31+ // SHOW WELCOME, SHOW LOGIN BUTTON
32+ // HIDE LOGIN BUTTON, ADD REGISTER BUTTON
33+ //
34+ else {
35+ let loginArea = document . getElementById ( 'loginStatusArea' ) ;
36+ document . getElementById ( 'prototype' ) . style . display = "block" ;
37+ let html = `<input type="button" onclick="window.location.href='/register'" value="register" style="padding: 1em; border-radius:0.5em; font-size: 100%;background-color: #efe;">`
38+ let span = document . createElement ( "SPAN" )
39+ span . innerHTML = html
40+ loginArea . appendChild ( span ) ;
41+ loginArea . appendChild ( UI . authn . loginStatusBox ( document , null , { } ) )
42+ const signUpButton = loginArea . querySelectorAll ( 'input' ) [ 2 ] ;
43+ signUpButton . style . display = "none" ;
44+ }
45+ }
46+ } )
47+ </ script >
48+ < link href ="/mash.css " rel ="stylesheet ">
49+ </ head > < body class ="db-layout ">
50+
51+ < h3 style ="padding:2em; border:8px solid #7C4DFF; display:none " id ="loggedIn " class ="container "> </ h3 >
52+
53+ < div id ="prototype " class ="container ">
54+
55+ < div class ="page-header " style ="display: inline-flex; ">
56+ < h1 > Welcome to the Solid Prototype</ h1 >
57+ < div id ="loginStatusArea " class ="pull-right " style ="display: inline-flex;float: right;margin: 10px; "> </ div >
58+
59+ </ div >
2160
2261 < p class ="lead ">
2362 This is a prototype implementation of a Solid server.
@@ -27,14 +66,9 @@ <h1>Welcome to the Solid Prototype</h1>
2766 If you have not already done so, please create an account.
2867 </ p >
2968
30- < p class ="lead hidden " id ="loggedIn ">
31- You are logged in as
32- < a href ="# " id ="profileLink "> </ a > .
33- </ p >
34-
3569 < section >
3670 {{#if serverLogo}}
37- < img src ="{{serverLogo}} " />
71+ < img src ="{{serverLogo}} " />
3872 {{/if}}
3973 < h2 > Server info</ h2 >
4074 < dl >
@@ -49,7 +83,26 @@ <h2>Server info</h2>
4983 </ dl >
5084 </ section >
5185</ div >
52- < script src ="/common/js/solid-auth-client.bundle.js "> </ script >
53- < script src ="/common/js/auth-buttons.js "> </ script >
54- </ body >
55- </ html >
86+ < header class ="db-layout__header header " id ="PageHeader "> </ header >
87+ < div class ="TabulatorOutline db-layout__content " id ="DummyUUID " role ="main ">
88+ < table id ="outline "> </ table >
89+ < div id ="GlobalDashboard "> </ div >
90+ </ div > < footer class ="db-layout__footer " id ="PageFooter "> </ footer >
91+ < style >
92+ # prototype {
93+ margin : 2em ;
94+ padding : 1em ;
95+ }
96+ # prototype input {
97+ margin : 1em ;
98+ padding : 0.5em !important ;
99+ }
100+ # loginStatusArea {
101+ float : right;
102+ clear : right;
103+ margin-top : -5em ;
104+ }
105+ </ style >
106+
107+ < script src ="/mashlib.js "> </ script >
108+ </ body > </ html >
0 commit comments