Support for CloudFlare.

[WIKI]
* NEW: Use a different URL for editing pages, so that CloudFlare can be used.
* BUG: Fix css of message boxes.
This commit is contained in:
gambas 2021-02-23 00:48:54 +01:00
parent f212d5abf8
commit 36b0b55c5b
5 changed files with 68 additions and 36 deletions

View file

@ -1,7 +1,6 @@
# Gambas Project File 3.0
Title=Gambas Wiki Web Application
Startup=Main
UseHttpServer=1
Icon=icon.png
Version=3.15.90
VersionFile=1

View file

@ -219,14 +219,22 @@ TABLE.desc > TBODY > TR > TH {
}
.header-bar INPUT[type=submit],.header-bar INPUT[type=button] {
background-color: #A0A0A0;
background-color: #C0C0C0;
color: white;
font-size: 80%;
height: 1.6em;
border: none;
border: solid 1px transparent;
cursor: pointer;
font-weight: bold;
text-transform: uppercase;
box-sizing: border-box;
}
.header-bar INPUT[type=submit]:hover,.header-bar INPUT[type=button]:hover {
border: solid 1px #A0A0A0;
}
.header-bar INPUT[type=text] {
font-size: 80%;
height: 1.6em;
@ -361,51 +369,56 @@ DIV.box {
DIV.info {
margin-top: 0.75em;
display: inline-block;
border: solid #D8D8D8 1px;
padding: 0.5em;
padding-left: 48px;
background: url('<%/%>/info.png') 8px 8px no-repeat;
min-height: 32px;
padding-left: 3em;
background: url('<%/%>/info.png') 0.5em 0.5em no-repeat;
min-height: 2em;
background-color: #EFF7FF;
border: solid 1px rgba(0,0,0,0.1);
}
DIV.warning {
margin-top: 0.75em;
display: inline-block;
border: solid #D8D8D8 1px;
padding: 8px;
padding-left: 48px;
background: url('<%/%>/warning.png') 8px 8px no-repeat;
min-height: 32px;
padding: 0.5em;
padding-left: 3em;
background: url('<%/%>/warning.png') 0.5em 0.5em no-repeat;
min-height: 2em;
background-color: #FFF6EF;
border: solid 1px rgba(0,0,0,0.1);
}
DIV.tip {
margin-top: 0.75em;
display: inline-block;
border: solid #D8D8D8 1px;
padding: 8px;
padding-left: 48px;
background: url('<%/%>/tip.png') 8px 8px no-repeat;
min-height: 32px;
padding: 0.5em;
padding-left: 3em;
background: url('<%/%>/tip.png') 0.5em 0.5em no-repeat;
min-height: 2em;
background-color: #EFFFEF;
border: solid 1px rgba(0,0,0,0.1);
}
DIV.vb {
margin-top: 0.75em;
display: inline-block;
border: solid #D8D8D8 1px;
padding: 8px;
padding-left: 48px;
background: url('<%/%>/vb.png') 8px 8px no-repeat;
min-height: 32px;
padding: 0.5em;
padding-left: 3em;
background: url('<%/%>/vb.png') 0.5em 0.5em no-repeat;
min-height: 2em;
background-color: #FFFCEF;
border: solid 1px rgba(0,0,0,0.1);
}
DIV.critical {
margin-top: 0.75em;
display: inline-block;
border: solid #D8D8D8 1px;
padding: 8px;
padding-left: 48px;
background: url('<%/%>/critical.png') 8px 8px no-repeat;
min-height: 32px;
padding: 0.5em;
padding-left: 3em;
background: url('<%/%>/critical.png') 0.5em 0.5em no-repeat;
min-height: 2em;
background-color: #FFEFEF;
border: solid 1px rgba(0,0,0,0.1);
}
DIV.example, DIV.seealso {
@ -437,8 +450,10 @@ TABLE.index TD {
DIV.index {
display: inline-block;
font-size: 85%;
padding: 0;
padding: 0.5em;
padding-right: 1.5em;
margin-top: 0.75em;
border: solid 1px #C0C0C0;
}
/*------------------------------------------------------------------*/
@ -653,7 +668,7 @@ DIV.syntax > P:first-child {
.user-name {
display: inline-block;
margin-right: 1em;
font-size: 90%;
}
DIV.welcome {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 909 B

View file

@ -332,7 +332,7 @@ End
'
' End
'
Private Sub AddCacheHeaders(Optional dLast As Date)
Public Sub AddCacheHeaders(Optional dLast As Date)
'If InternetExplorer Then Return
@ -340,9 +340,8 @@ Private Sub AddCacheHeaders(Optional dLast As Date)
Try dLast = Stat(Args[0]).LastModified
If Error Then dLast = Now
Endif
Response.AddHeader("Expires", CGI.FormatDate(DateAdd(Now, gb.Month, 2)))
Response.AddHeader("Cache-Control", "public")
'Response.AddHeader("Cache-Control", "max-age=5184000")
'Response.AddHeader("Expires", CGI.FormatDate(DateAdd(Now, gb.Month, 2)))
Response.AddHeader("Cache-Control", "public,max-age=3600,must-revalidate")
Response.AddHeader("Last-Modified", CGI.FormatDate(dLast))
End
@ -423,12 +422,15 @@ Public Sub Main()
Dim sSearch As String
Dim sReplace As String
' Print "data:image/png;base64,"; URL.Encode(Base64$(File.Load(".public/critical.png")));
' Quit
' If Application.Host = "gambasfarm.org" Then
' Response.Redirect("http://gambasfarm.org/farm")
' Return
' Endif
CGI["SCRIPT_NAME"] = "/wiki" ' Fix web server bug
'CGI["SCRIPT_NAME"] = "/wiki" ' Fix web server bug
Root = User.Home &/ "wiki/gambas"
InfoDir = User.Home &/ "wiki/info"
If Not Exist(InfoDir) Then InfoDir = ""
@ -590,8 +592,9 @@ Public Sub Main()
If Request.Exist("logout") Then
Session.CookiePath = "/"
Session.Abandon
Redirect()
Response.Redirect("/wiki" &/ Request.Path & LinkSuffix)
Return
' Else If Request.Exist("register") Then
@ -605,6 +608,7 @@ Public Sub Main()
cUser = LoadUser(Request["login"])
If cUser And If cUser["password"] = Request["password"] And If cUser["activé"] Then
Session.CookiePath = "/"
Session["login"] = LCase(Request["login"])
Session["full-name"] = Trim(cUser["prénom"] & " " & cUser["nom"])
Endif
@ -634,6 +638,11 @@ Public Sub Main()
If Session.Id Then
If Application.Root <> "/edit" Then
Response.Redirect("/edit" &/ Request.Path & LinkSuffix)
Return
Endif
If Request.Exist("save") Then
If Request.Exist("page") Then

View file

@ -1,5 +1,12 @@
' Gambas class file
Public Sub _new()
Me.Buffered = True
End
Private Sub _PrintTitle()
If Main.Path Then
@ -316,7 +323,9 @@ Private Sub _PrintPage()
Endif
Endif
sData = LTrim(File.Load(Main.GetPagePathFrom(sPath)))
sPath = Main.GetPagePathFrom(sPath)
If Session.Id Then Main.AddCacheHeaders(Stat(sPath).LastModified)
sData = LTrim(File.Load(sPath))
Endif