如何保护部署到Firebase Hosting 的Flutter Web 的源代码?
How to protect the source code of Flutter Web deployed to Firebase Hosting?
我制作了一个 Flutter Website 并部署到 Firebase Hosting,如果我检查 Google Chrome 上的页面,在“源”选项卡中可能会获取源代码网站。
有什么方法可以保护源代码,而不是像这样暴露整个代码吗?
如this page, you need to build your web app using the flutter build web
command, then deploy what you find in the ./build/web
folder, to Firebase所述。
如果您查看 source file,您会发现它是 compiled/minified。
// snippet
var r
var q=d
try{if(a[b]===s){r=a[b]=q
r=a[b]=d()}else r=a[b]}finally{if(r===q)a[b]=null
a[c]=function(){return this[b]}}return r}}function lazy(a,b,c,d){var s=a
a[b]=s
您看到的是 sourcemaps which show a developer friendly view of the compiled/minified code. I don't see any options 用于关闭源映射。
请记住,您正在发布客户端应用程序。一旦代码在其他计算机上,您就无法阻止他们对其进行逆向工程。
您似乎正在托管整个应用程序目录。
您需要使用 'flutter build web' 构建您的网站。
然后 'firebase deploy' build/web 目录。
您需要在项目路径中的 firebase.json 中指定:
{
"hosting": {
"site": "YOUR_WEBSITE_NAME",
"public": "build/web/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
我制作了一个 Flutter Website 并部署到 Firebase Hosting,如果我检查 Google Chrome 上的页面,在“源”选项卡中可能会获取源代码网站。
有什么方法可以保护源代码,而不是像这样暴露整个代码吗?
如this page, you need to build your web app using the flutter build web
command, then deploy what you find in the ./build/web
folder, to Firebase所述。
如果您查看 source file,您会发现它是 compiled/minified。
// snippet
var r
var q=d
try{if(a[b]===s){r=a[b]=q
r=a[b]=d()}else r=a[b]}finally{if(r===q)a[b]=null
a[c]=function(){return this[b]}}return r}}function lazy(a,b,c,d){var s=a
a[b]=s
您看到的是 sourcemaps which show a developer friendly view of the compiled/minified code. I don't see any options 用于关闭源映射。
请记住,您正在发布客户端应用程序。一旦代码在其他计算机上,您就无法阻止他们对其进行逆向工程。
您似乎正在托管整个应用程序目录。 您需要使用 'flutter build web' 构建您的网站。 然后 'firebase deploy' build/web 目录。 您需要在项目路径中的 firebase.json 中指定:
{
"hosting": {
"site": "YOUR_WEBSITE_NAME",
"public": "build/web/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}