Skip to content

Commit 4363196

Browse files
Merge pull request #416 from treefrogframework/vitevue
Vite vue.js module
2 parents d1ba40c + bc12a4f commit 4363196

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1656
-499
lines changed

.github/workflows/actions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ jobs:
364364
vs-version: '[17,18)' # 17.xx
365365
msbuild-architecture: x64
366366
- name: Install Qt
367-
uses: jurplel/install-qt-action@v4
367+
uses: jurplel/install-qt-action@v4.1.1
368368
with:
369369
version: 6.8.0
370370
host: windows
@@ -414,7 +414,7 @@ jobs:
414414
steps:
415415
- uses: actions/checkout@main
416416
- name: Install Qt
417-
uses: jurplel/install-qt-action@v4
417+
uses: jurplel/install-qt-action@v4.1.1
418418
with:
419419
version: 6.8.0
420420
host: windows
@@ -466,7 +466,7 @@ jobs:
466466
steps:
467467
- uses: actions/checkout@main
468468
- name: Install Qt
469-
uses: jurplel/install-qt-action@v4
469+
uses: jurplel/install-qt-action@v4.1.1
470470
with:
471471
version: 6.5.2
472472
host: windows

configure.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
22
@setlocal
33

4-
set VERSION=2.10.1
4+
set VERSION=2.11.0
55
set TFDIR=C:\TreeFrog\%VERSION%
66
set MONBOC_VERSION=1.26.2
77
set LZ4_VERSION=1.9.4

defaults/development.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Template system section
88
##
99

10-
# Specify the template system of view, ERB or Otama.
11-
TemplateSystem=ERB
10+
# Template system of view.
11+
TemplateSystem=$TemplateSystem$
1212

1313

1414
##

installer/create_installer.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:: 10行目、28行目、39行目を編集
88

99

10-
set VERSION=2.10.1
10+
set VERSION=2.11.0
1111
set QTBASE=C:\Qt
1212
set TFDIR=C:\TreeFrog\%VERSION%
1313

installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace System::Security::Permissions;
3131
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
3232
// 既定値にすることができます:
3333

34-
[assembly:AssemblyVersionAttribute("2.10.1")];
34+
[assembly:AssemblyVersionAttribute("2.11.0")];
3535

3636
[assembly:ComVisible(false)];
3737

src/corelib.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ linux-* {
412412
SOURCES += tthreadapplicationserver_linux.cpp
413413
SOURCES += tredisdriver_linux.cpp
414414
SOURCES += tmemcacheddriver_linux.cpp
415+
SOURCES += tsharedmemory_linux.cpp
415416
}
416417

417418
# For Mac
@@ -420,6 +421,7 @@ macx {
420421
SOURCES += tthreadapplicationserver_qt.cpp
421422
SOURCES += tredisdriver_qt.cpp
422423
SOURCES += tmemcacheddriver_qt.cpp
424+
SOURCES += tsharedmemory_macx.cpp
423425
}
424426

425427
# For UNIX

src/tabstractcontroller.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class T_CORE_EXPORT TAbstractController : public QObject {
2323
virtual const TSession &session() const;
2424
virtual QString getRenderingData(const QString &templateName, const QVariantMap &vars = QVariantMap());
2525
virtual QByteArray authenticityToken() const { return QByteArray(); }
26+
virtual QVariantMap flashVariants() const { return QVariantMap(); }
27+
virtual QVariant flashVariant(const QString &) const { return QVariant(); }
28+
virtual QJsonObject flashVariantsJson() const { return QJsonObject(); }
29+
virtual QJsonObject flashVariantJson(const QString &) const { return QJsonObject(); }
2630
virtual void setFlash(const QString &name, const QVariant &value);
2731
void exportVariant(const QString &name, const QVariant &value, bool overwrite = true);
2832
virtual bool isUserLoggedIn() const;

src/tactioncontext.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,8 @@ void TActionContext::execute(THttpRequest &request)
155155
tSystemDebug("Re-generate session ID: {}", (const char*)_currController->session().sessionId.data());
156156
}
157157

158-
if (EnableCsrfProtectionModuleFlag && _currController->csrfProtectionEnabled()) {
159-
// Sets CSRF protection information
160-
TActionController::setCsrfProtectionInto(_currController->session());
161-
}
158+
// Sets CSRF protection information
159+
TActionController::setCsrfProtectionInto(_currController->session());
162160
}
163161

164162
// Database Transaction

src/tactioncontroller.cpp

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
#include <TWebApplication>
3232
#include <QStringEncoder>
3333

34-
const QString FLASH_VARS_SESSION_KEY("_flashVariants");
34+
const QString QUEUED_FLASH_SESSION_KEY("_flashVariants");
35+
const QString FLASH_VARS_SESSION_KEY("_activeFlash");
3536
const QString LOGIN_USER_NAME_KEY("_loginUserName");
3637
const QByteArray DEFAULT_CONTENT_TYPE("text/html");
3738

@@ -207,7 +208,11 @@ void TActionController::setCsrfProtectionInto(TSession &session)
207208
{
208209
if (TSessionManager::instance().storeType() == QLatin1String("cookie")) {
209210
QString key = TSessionManager::instance().csrfProtectionKey();
210-
session.insert(key, TSessionManager::instance().generateId()); // it's just a random value
211+
QByteArray val = session.value(key).toByteArray();
212+
213+
if (val.isEmpty()) {
214+
session.insert(key, TSessionManager::instance().generateId()); // it's just a random value
215+
}
211216
}
212217
}
213218

@@ -248,6 +253,7 @@ QString TActionController::loginUserNameKey()
248253
bool TActionController::verifyRequest(const THttpRequest &request) const
249254
{
250255
if (!csrfProtectionEnabled()) {
256+
tSystemWarn("Skipped verifying authenticity token : {}", request.header().path().data());
251257
return true;
252258
}
253259

@@ -263,7 +269,11 @@ bool TActionController::verifyRequest(const THttpRequest &request) const
263269
}
264270

265271
tSystemDebug("postAuthToken: {}", (const char*)postAuthToken.data());
266-
return Tf::strcmp(postAuthToken, authenticityToken());
272+
bool res = Tf::strcmp(postAuthToken, authenticityToken());
273+
if (res) {
274+
tSystemDebug("Verified authenticity token : {}", request.header().path().data());
275+
}
276+
return res;
267277
}
268278

269279
/*!
@@ -595,7 +605,7 @@ void TActionController::redirect(const QUrl &url, int statusCode)
595605
// Enable flash-variants
596606
QVariant var;
597607
var.setValue(_flashVars);
598-
_sessionStore.insert(FLASH_VARS_SESSION_KEY, var);
608+
_sessionStore.insert(QUEUED_FLASH_SESSION_KEY, var);
599609
}
600610

601611
/*!
@@ -655,12 +665,39 @@ bool TActionController::sendData(const QByteArray &data, const QByteArray &conte
655665
*/
656666
void TActionController::exportAllFlashVariants()
657667
{
658-
QVariant var = _sessionStore.take(FLASH_VARS_SESSION_KEY);
668+
_sessionStore.remove(FLASH_VARS_SESSION_KEY);
669+
670+
QVariant var = _sessionStore.take(QUEUED_FLASH_SESSION_KEY);
659671
if (!var.isNull()) {
660672
exportVariants(var.toMap());
673+
_sessionStore.insert(FLASH_VARS_SESSION_KEY, var);
661674
}
662675
}
663676

677+
678+
QVariantMap TActionController::flashVariants() const
679+
{
680+
return _sessionStore.value(FLASH_VARS_SESSION_KEY).toMap();
681+
}
682+
683+
684+
QVariant TActionController::flashVariant(const QString &key) const
685+
{
686+
return _sessionStore.value(FLASH_VARS_SESSION_KEY).toMap().value(key);
687+
}
688+
689+
690+
QJsonObject TActionController::flashVariantsJson() const
691+
{
692+
return QJsonObject::fromVariantMap(flashVariants());
693+
}
694+
695+
696+
QJsonObject TActionController::flashVariantJson(const QString &key) const
697+
{
698+
return QJsonObject::fromVariantMap(flashVariant(key).toMap());
699+
}
700+
664701
/*!
665702
Validates the access of the user \a user. Returns true if the user
666703
access is allowed by rule; otherwise returns false.

src/tactioncontroller.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ class T_CORE_EXPORT TActionController : public TAbstractController, public TActi
3737
virtual QStringList exceptionActionsOfCsrfProtection() const { return QStringList(); }
3838
virtual bool transactionEnabled() const { return true; }
3939
QByteArray authenticityToken() const override;
40-
QString flash(const QString &name) const;
40+
QVariantMap flashVariants() const override;
41+
QVariant flashVariant(const QString &key) const override;
42+
QJsonObject flashVariantsJson() const override;
43+
QJsonObject flashVariantJson(const QString &key) const override;
44+
//QString flash(const QString &name) const;
4145
QHostAddress clientAddress() const;
4246
virtual bool isUserLoggedIn() const override;
4347
virtual QString identityKeyOfLoginUser() const;
@@ -199,10 +203,10 @@ inline void TActionController::setStatusCode(int code)
199203
_statCode = code;
200204
}
201205

202-
inline QString TActionController::flash(const QString &name) const
203-
{
204-
return _flashVars.value(name).toString();
205-
}
206+
// inline QString TActionController::flash(const QString &name) const
207+
// {
208+
// return _flashVars.value(name).toString();
209+
// }
206210

207211
inline QByteArray TActionController::contentType() const
208212
{

0 commit comments

Comments
 (0)