Skip to content

Vite vue.js module #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ jobs:
vs-version: '[17,18)' # 17.xx
msbuild-architecture: x64
- name: Install Qt
uses: jurplel/install-qt-action@v4
uses: jurplel/install-qt-action@v4.1.1
with:
version: 6.8.0
host: windows
Expand Down Expand Up @@ -414,7 +414,7 @@ jobs:
steps:
- uses: actions/checkout@main
- name: Install Qt
uses: jurplel/install-qt-action@v4
uses: jurplel/install-qt-action@v4.1.1
with:
version: 6.8.0
host: windows
Expand Down Expand Up @@ -466,7 +466,7 @@ jobs:
steps:
- uses: actions/checkout@main
- name: Install Qt
uses: jurplel/install-qt-action@v4
uses: jurplel/install-qt-action@v4.1.1
with:
version: 6.5.2
host: windows
Expand Down
2 changes: 1 addition & 1 deletion configure.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
@setlocal

set VERSION=2.10.1
set VERSION=2.11.0
set TFDIR=C:\TreeFrog\%VERSION%
set MONBOC_VERSION=1.26.2
set LZ4_VERSION=1.9.4
Expand Down
4 changes: 2 additions & 2 deletions defaults/development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
## Template system section
##

# Specify the template system of view, ERB or Otama.
TemplateSystem=ERB
# Template system of view.
TemplateSystem=$TemplateSystem$


##
Expand Down
2 changes: 1 addition & 1 deletion installer/create_installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:: 10行目、28行目、39行目を編集


set VERSION=2.10.1
set VERSION=2.11.0
set QTBASE=C:\Qt
set TFDIR=C:\TreeFrog\%VERSION%

Expand Down
2 changes: 1 addition & 1 deletion installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace System::Security::Permissions;
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:

[assembly:AssemblyVersionAttribute("2.10.1")];
[assembly:AssemblyVersionAttribute("2.11.0")];

[assembly:ComVisible(false)];

Expand Down
2 changes: 2 additions & 0 deletions src/corelib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ linux-* {
SOURCES += tthreadapplicationserver_linux.cpp
SOURCES += tredisdriver_linux.cpp
SOURCES += tmemcacheddriver_linux.cpp
SOURCES += tsharedmemory_linux.cpp
}

# For Mac
Expand All @@ -420,6 +421,7 @@ macx {
SOURCES += tthreadapplicationserver_qt.cpp
SOURCES += tredisdriver_qt.cpp
SOURCES += tmemcacheddriver_qt.cpp
SOURCES += tsharedmemory_macx.cpp
}

# For UNIX
Expand Down
4 changes: 4 additions & 0 deletions src/tabstractcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class T_CORE_EXPORT TAbstractController : public QObject {
virtual const TSession &session() const;
virtual QString getRenderingData(const QString &templateName, const QVariantMap &vars = QVariantMap());
virtual QByteArray authenticityToken() const { return QByteArray(); }
virtual QVariantMap flashVariants() const { return QVariantMap(); }
virtual QVariant flashVariant(const QString &) const { return QVariant(); }
virtual QJsonObject flashVariantsJson() const { return QJsonObject(); }
virtual QJsonObject flashVariantJson(const QString &) const { return QJsonObject(); }
virtual void setFlash(const QString &name, const QVariant &value);
void exportVariant(const QString &name, const QVariant &value, bool overwrite = true);
virtual bool isUserLoggedIn() const;
Expand Down
6 changes: 2 additions & 4 deletions src/tactioncontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ void TActionContext::execute(THttpRequest &request)
tSystemDebug("Re-generate session ID: {}", (const char*)_currController->session().sessionId.data());
}

if (EnableCsrfProtectionModuleFlag && _currController->csrfProtectionEnabled()) {
// Sets CSRF protection information
TActionController::setCsrfProtectionInto(_currController->session());
}
// Sets CSRF protection information
TActionController::setCsrfProtectionInto(_currController->session());
}

// Database Transaction
Expand Down
47 changes: 42 additions & 5 deletions src/tactioncontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#include <TWebApplication>
#include <QStringEncoder>

const QString FLASH_VARS_SESSION_KEY("_flashVariants");
const QString QUEUED_FLASH_SESSION_KEY("_flashVariants");
const QString FLASH_VARS_SESSION_KEY("_activeFlash");
const QString LOGIN_USER_NAME_KEY("_loginUserName");
const QByteArray DEFAULT_CONTENT_TYPE("text/html");

Expand Down Expand Up @@ -207,7 +208,11 @@ void TActionController::setCsrfProtectionInto(TSession &session)
{
if (TSessionManager::instance().storeType() == QLatin1String("cookie")) {
QString key = TSessionManager::instance().csrfProtectionKey();
session.insert(key, TSessionManager::instance().generateId()); // it's just a random value
QByteArray val = session.value(key).toByteArray();

if (val.isEmpty()) {
session.insert(key, TSessionManager::instance().generateId()); // it's just a random value
}
}
}

Expand Down Expand Up @@ -248,6 +253,7 @@ QString TActionController::loginUserNameKey()
bool TActionController::verifyRequest(const THttpRequest &request) const
{
if (!csrfProtectionEnabled()) {
tSystemWarn("Skipped verifying authenticity token : {}", request.header().path().data());
return true;
}

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

tSystemDebug("postAuthToken: {}", (const char*)postAuthToken.data());
return Tf::strcmp(postAuthToken, authenticityToken());
bool res = Tf::strcmp(postAuthToken, authenticityToken());
if (res) {
tSystemDebug("Verified authenticity token : {}", request.header().path().data());
}
return res;
}

/*!
Expand Down Expand Up @@ -595,7 +605,7 @@ void TActionController::redirect(const QUrl &url, int statusCode)
// Enable flash-variants
QVariant var;
var.setValue(_flashVars);
_sessionStore.insert(FLASH_VARS_SESSION_KEY, var);
_sessionStore.insert(QUEUED_FLASH_SESSION_KEY, var);
}

/*!
Expand Down Expand Up @@ -655,12 +665,39 @@ bool TActionController::sendData(const QByteArray &data, const QByteArray &conte
*/
void TActionController::exportAllFlashVariants()
{
QVariant var = _sessionStore.take(FLASH_VARS_SESSION_KEY);
_sessionStore.remove(FLASH_VARS_SESSION_KEY);

QVariant var = _sessionStore.take(QUEUED_FLASH_SESSION_KEY);
if (!var.isNull()) {
exportVariants(var.toMap());
_sessionStore.insert(FLASH_VARS_SESSION_KEY, var);
}
}


QVariantMap TActionController::flashVariants() const
{
return _sessionStore.value(FLASH_VARS_SESSION_KEY).toMap();
}


QVariant TActionController::flashVariant(const QString &key) const
{
return _sessionStore.value(FLASH_VARS_SESSION_KEY).toMap().value(key);
}


QJsonObject TActionController::flashVariantsJson() const
{
return QJsonObject::fromVariantMap(flashVariants());
}


QJsonObject TActionController::flashVariantJson(const QString &key) const
{
return QJsonObject::fromVariantMap(flashVariant(key).toMap());
}

/*!
Validates the access of the user \a user. Returns true if the user
access is allowed by rule; otherwise returns false.
Expand Down
14 changes: 9 additions & 5 deletions src/tactioncontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class T_CORE_EXPORT TActionController : public TAbstractController, public TActi
virtual QStringList exceptionActionsOfCsrfProtection() const { return QStringList(); }
virtual bool transactionEnabled() const { return true; }
QByteArray authenticityToken() const override;
QString flash(const QString &name) const;
QVariantMap flashVariants() const override;
QVariant flashVariant(const QString &key) const override;
QJsonObject flashVariantsJson() const override;
QJsonObject flashVariantJson(const QString &key) const override;
//QString flash(const QString &name) const;
QHostAddress clientAddress() const;
virtual bool isUserLoggedIn() const override;
virtual QString identityKeyOfLoginUser() const;
Expand Down Expand Up @@ -199,10 +203,10 @@ inline void TActionController::setStatusCode(int code)
_statCode = code;
}

inline QString TActionController::flash(const QString &name) const
{
return _flashVars.value(name).toString();
}
// inline QString TActionController::flash(const QString &name) const
// {
// return _flashVars.value(name).toString();
// }

inline QByteArray TActionController::contentType() const
{
Expand Down
120 changes: 87 additions & 33 deletions src/tactionview.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010-2019, AOYAMA Kazuharu
/* Copyright (c) 2010-2025, AOYAMA Kazuharu
* All rights reserved.
*
* This software may be used and distributed according to the terms of
Expand Down Expand Up @@ -72,68 +72,122 @@ QString TActionView::authenticityToken() const
}

/*!
Outputs the string of the HTML attribute \a attr to a view
template.
Returns flash variants;
*/
QString TActionView::echo(const THtmlAttribute &attr)
QVariantMap TActionView::flashVariants() const
{
responsebody += attr.toString().trimmed();
return QString();
static QVariantMap dummy;
return (actionController) ? actionController->flashVariants() : dummy;
}

/*!
\fn QString TActionView::echo(const THtmlAttribute &attr)
Outputs the string of the HTML attribute \a attr to a view
template.
*/

/*!
\fn QString TActionView::echo(const QVariant &var)
Outputs the variant variable \a var to a view template.
*/
QString TActionView::echo(const QVariant &var)
{
if (var.userType() == QMetaType::QUrl) {
responsebody += var.toUrl().toString(QUrl::FullyEncoded);
} else {
responsebody += var.toString();
}
return QString();
}

/*!
\fn QString TActionView::echo(const QVariantMap &map)
Outputs the variantmap variable \a map to a view template.
*/
QString TActionView::echo(const QVariantMap &map)
{
responsebody += QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact);
return QString();
}

/*!
\fn QString TActionView::eh(const THtmlAttribute &attr)
Outputs a escaped string of the HTML attribute \a attr to
a view template.
*/
QString TActionView::eh(const THtmlAttribute &attr)
{
return echo(THttpUtility::htmlEscape(attr.toString().trimmed()));
}

/*!
\fn QString TActionView::eh(const QVariant &var)
Outputs a escaped string of the variant variable \a var
to a view template.
*/
QString TActionView::eh(const QVariant &var)

/*!
\fn QString TActionView::eh(const QVariantMap &map)
Outputs a escaped string of the variantmap variable \a map
to a view template.
*/


QString TActionView::fromValue(int n, int base)
{
return QString::number(n, base);
}


QString TActionView::fromValue(long n, int base)
{
return QString::number(n, base);
}


QString TActionView::fromValue(ulong n, int base)
{
return QString::number(n, base);
}


QString TActionView::fromValue(qlonglong n, int base)
{
return QString::number(n, base);
}


QString TActionView::fromValue(qulonglong n, int base)
{
return QString::number(n, base);
}


QString TActionView::fromValue(double d, char format, int precision)
{
return QString::number(d, format, precision);
}


QString TActionView::fromValue(const QJsonObject &object)
{
return QJsonDocument(object).toJson(QJsonDocument::Compact);
}


QString TActionView::fromValue(const QJsonArray &array)
{
return QJsonDocument(array).toJson(QJsonDocument::Compact);
}


QString TActionView::fromValue(const QJsonDocument &doc)
{
return doc.toJson(QJsonDocument::Compact);
}


QString TActionView::fromValue(const THtmlAttribute &attr)
{
return attr.toString().trimmed();
}


QString TActionView::fromValue(const QVariant &var)
{
if (var.userType() == QMetaType::QUrl) {
return echo(var.toUrl().toString(QUrl::FullyEncoded));
return var.toUrl().toString(QUrl::FullyEncoded);
} else {
return echo(THttpUtility::htmlEscape(var.toString()));
return var.toString();
}
}

/*!
Outputs a escaped string of the variantmap variable \a map
to a view template.
*/
QString TActionView::eh(const QVariantMap &map)

QString TActionView::fromValue(const QVariantMap &map)
{
return echo(THttpUtility::htmlEscape(QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact)));
return QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact);
}

/*!
Expand Down
Loading
Loading