Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Alderaan
pan-light
提交
cab15ba1
P
pan-light
项目概览
Alderaan
/
pan-light
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pan-light
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
cab15ba1
编写于
6月 26, 2019
作者:
P
peterq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change: 部署调整
上级
5d9ec8bc
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
479 addition
and
145 deletion
+479
-145
demo/demo-online-front/package-lock.json
demo/demo-online-front/package-lock.json
+410
-92
demo/demo-online-front/package.json
demo/demo-online-front/package.json
+5
-2
demo/demo-online-front/public/index.html
demo/demo-online-front/public/index.html
+2
-0
demo/demo-online-front/src/app.js
demo/demo-online-front/src/app.js
+11
-2
demo/demo-online-front/src/comp/chat/chat-main.vue
demo/demo-online-front/src/comp/chat/chat-main.vue
+4
-0
demo/demo-online-front/src/comp/hostList.vue
demo/demo-online-front/src/comp/hostList.vue
+10
-3
demo/demo-online-front/src/comp/layout.vue
demo/demo-online-front/src/comp/layout.vue
+4
-0
demo/demo-online-front/vue.config.js
demo/demo-online-front/vue.config.js
+26
-0
demo/demo-online-front/ws.js
demo/demo-online-front/ws.js
+0
-38
server/.gitignore
server/.gitignore
+2
-1
server/demo/demo-init.go
server/demo/demo-init.go
+4
-1
server/pan-light-server.go
server/pan-light-server.go
+1
-6
未找到文件。
demo/demo-online-front/package-lock.json
浏览文件 @
cab15ba1
此差异已折叠。
点击以展开。
demo/demo-online-front/package.json
浏览文件 @
cab15ba1
...
...
@@ -9,10 +9,13 @@
},
"dependencies"
:
{
"core-js"
:
"^2.6.5"
,
"element-ui"
:
"^2.7.2"
,
"crc32"
:
"^0.2.2"
,
"deflate-js"
:
"^0.2.3"
,
"element-ui"
:
"^2.10.0"
,
"gzip-js"
:
"^0.3.2"
,
"moment"
:
"^2.24.0"
,
"vue"
:
"^2.6.6"
"vue"
:
"^2.6.6"
,
"webpack-obfuscator"
:
"^0.18.0"
},
"devDependencies"
:
{
"@vue/cli-plugin-babel"
:
"^3.5.0"
,
...
...
demo/demo-online-front/public/index.html
浏览文件 @
cab15ba1
...
...
@@ -11,10 +11,12 @@ Thanks for these great projects and technologies!
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<title>
pan-light | 在线体验
</title>
<base
href=
"https://qiniu-cdn.peterq.cn/pan-light/demo/"
>
</head>
<body>
<script>
window
.
debugObj
=
window
.
debugObj
||
{}
window
.
cdnPrefix
=
'
https://qiniu-cdn.peterq.cn/pan-light
'
</script>
<noscript>
<strong>
We're sorry but demo-online-front doesn't work properly without JavaScript enabled. Please enable it to continue.
</strong>
...
...
demo/demo-online-front/src/app.js
浏览文件 @
cab15ba1
...
...
@@ -45,7 +45,12 @@ registerProxyChannelResolver(async function (uri) {
})
const
connectionRequestMap
=
{}
console
.
log
(
process
.
env
)
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
setInterval
(
function
()
{
window
.
debugObj
=
{}
},
3
e3
)
}
$rt
.
onRemote
(
"
host.candidate.ok
"
,
data
=>
{
const
id
=
data
.
requestId
...
...
@@ -91,6 +96,7 @@ function roomHandleUserTicketTurn(room, data) {
}
let
cdnPrefix
=
process
.
env
.
NODE_ENV
===
'
production
'
?
window
.
cdnPrefix
:
''
$rt
.
on
(
'
room.new
'
,
room
=>
{
async
function
getSessionInfo
(
ids
)
{
...
...
@@ -103,6 +109,8 @@ $rt.on('room.new', room => {
})
let
infoMap
=
await
$rt
.
call
(
'
session.public.info
'
,
{
sessionIds
:
newOnes
})
for
(
let
id
in
infoMap
)
{
infoMap
[
id
].
avatar
=
cdnPrefix
+
infoMap
[
id
].
avatar
console
.
log
(
infoMap
[
id
])
$state
.
userSessionInfo
[
id
]
=
infoMap
[
id
]
}
}
...
...
@@ -178,6 +186,7 @@ $rt.on('room.new', room => {
$rt
.
onRemote
(
'
session.new
'
,
async
session
=>
{
$state
.
resetData
()
let
infoMap
=
await
$rt
.
call
(
'
session.public.info
'
,
{
sessionIds
:
[
session
.
id
]})
infoMap
[
session
.
id
].
avatar
=
cdnPrefix
+
infoMap
[
session
.
id
].
avatar
$state
.
userSessionInfo
.
self
=
{...
infoMap
[
session
.
id
],
sessionId
:
session
.
id
}
$state
.
connected
=
true
})
...
...
@@ -420,7 +429,7 @@ async function canStart() {
function
fuckDebug
()
{
console
.
clear
()
document
.
body
.
innerHTML
=
`<h1>偷窥人家可是不好的哦</h1>`
consoleImage
(
location
.
origin
+
whatJpg
,
240
,
240
)
consoleImage
(
(
cdnPrefix
||
location
.
origin
)
+
'
/demo
'
+
whatJpg
,
240
,
240
)
console
.
log
(
'
%c想要演示系统源码? 快去点个star啦, 超过 200 star 开源此在线演示系统 https://github.com/peterq/pan-light
'
,
'
font-size:24px;color:#0a0
'
)
console
.
log
(
'
如果你想现在拿到源码, 你可以尝试分析一下: web端和服务端通信规则, 以及远程桌面的实现原理; 把分析结果发送到邮箱 me@peterq.cn , 我会回复源码哦. ps:难度其实不是特别大哦.
'
)
console
.
log
(
'
%c请求各位大佬不要对我的服务器进行压测, 阿里云最低配机器, 穷.
'
,
'
font-size:18px;
'
)
...
...
demo/demo-online-front/src/comp/chat/chat-main.vue
浏览文件 @
cab15ba1
...
...
@@ -6,6 +6,10 @@
<img
:src=
"$state.userSessionInfo.self.avatar"
style=
"border-radius: 50%;"
alt=
"avatar"
width=
"50"
height=
"50"
/>
<p>
{{
$state
.
userSessionInfo
.
self
.
nickname
}}
</p>
<p
style=
"margin: 20px"
v-if=
"$state.ticket"
>
<i
class=
"el-icon-time"
></i>
体验门票号码:
{{
$state
.
ticket
.
order
}}
</p>
</div>
<hr>
<el-tabs
v-model=
"activeRoom"
style=
"padding: 5px; flex: 1;"
>
...
...
demo/demo-online-front/src/comp/hostList.vue
浏览文件 @
cab15ba1
<
template
>
<div
style=
"flex: 1; flex-wrap: wrap;"
>
<el-button
@
click=
"clickGetTicket"
<el-button
v-show=
"hosts.length > 0"
@
click=
"clickGetTicket"
type=
"primary"
:disabled=
"$state.loading.getTicket"
v-if=
"!$state.ticket"
:loading=
"$state.loading.getTicket"
>
立即体验
...
...
@@ -20,6 +20,10 @@
</div>
</div>
</div>
<el-alert
class=
"no-host"
v-if=
"$state.connected && hosts.length === 0"
style=
"font-size: 30px"
title=
"抱歉, 当前没有主机可提供远程演示服务, 请联系管理员至少开启一台主机"
type=
"warning"
>
</el-alert>
</div>
</
template
>
...
...
@@ -48,7 +52,7 @@
async
getHosts
()
{
let
hosts
=
await
this
.
$rt
.
call
(
'
hosts.info
'
)
this
.
$state
.
hosts
=
hosts
return
hosts
return
hosts
||
[]
},
async
clickView
(
host
)
{
await
openDialog
(
InstanceList
,
host
.
name
).
getPromise
()
...
...
@@ -60,9 +64,12 @@
}
</
script
>
<
style
>
<
style
>
*
{
padding
:
0
;
margin
:
0
;
}
.no-host
.el-alert__title
{
font-size
:
16px
;
}
</
style
>
demo/demo-online-front/src/comp/layout.vue
浏览文件 @
cab15ba1
...
...
@@ -2,6 +2,7 @@
<el-container
style=
"height: 100vh;width: 100vw;"
>
<el-header>
pan-light 在线体验
<el-button
style=
"margin-left: 10px;"
@
click=
"clickReturnHome"
>
返回官网首页
</el-button>
</el-header>
<el-container
class=
"down-con"
>
<el-main
style=
"min-width: 800px"
>
...
...
@@ -45,6 +46,9 @@
})
},
methods
:
{
clickReturnHome
()
{
location
.
href
=
location
.
origin
}
},
watch
:
{
...
...
demo/demo-online-front/vue.config.js
浏览文件 @
cab15ba1
// const JavaScriptObfuscator = require('webpack-obfuscator')
module
.
exports
=
{
devServer
:
{
proxy
:
{
...
...
@@ -8,5 +10,29 @@ module.exports = {
}
}
},
configureWebpack
:
{
plugins
:
[
/*new JavaScriptObfuscator({
compact: true,//压缩代码
controlFlowFlattening: true,////是否启用控制流扁平化(降低1.5倍的运行速度)
controlFlowFlatteningThreshold: 0.75,////应用概率;在较大的代码库中,建议降低此值,因为大量的控制流转换可能会增加代码的大小并降低代码的速度。
deadCodeInjection: true,//随机的死代码块(增加了混淆代码的大小)
deadCodeInjectionThreshold: 0.4,//死代码块的影响概率
debugProtection: false,//此选项几乎不可能使用开发者工具的控制台选项卡
debugProtectionInterval: false,//如果选中,则会在“控制台”选项卡上使用间隔强制调试模式,从而更难使用“开发人员工具”的其他功能。
disableConsoleOutput: true,//通过用空函数替换它们来禁用console.log,console.info,console.error和console.warn。这使得调试器的使用更加困难。
identifierNamesGenerator: 'hexadecimal',//标识符的混淆方式 hexadecimal(十六进制) mangled(短标识符)
log: false,
renameGlobals: false,//是否启用全局变量和函数名称的混淆
rotateStringArray: true,//通过固定和随机(在代码混淆时生成)的位置移动数组。这使得将删除的字符串的顺序与其原始位置相匹配变得更加困难。如果原始源代码不小,建议使用此选项,因为辅助函数可以引起注意。
selfDefending: true,//混淆后的代码,不能使用代码美化,同时需要配置 cpmpat:true;
stringArray: true,//删除字符串文字并将它们放在一个特殊的数组中
stringArrayEncoding: 'base64',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false//允许启用/禁用字符串转换为unicode转义序列。Unicode转义序列大大增加了代码大小,并且可以轻松地将字符串恢复为原始视图。建议仅对小型源代码启用此选项。
}, []),*/
]
}
}
\ No newline at end of file
demo/demo-online-front/ws.js
已删除
100644 → 0
浏览文件 @
5d9ec8bc
此差异已折叠。
点击以展开。
server/.gitignore
浏览文件 @
cab15ba1
cmd/data
static/
\ No newline at end of file
static/
pan-light-server.prod.yaml
\ No newline at end of file
server/demo/demo-init.go
浏览文件 @
cab15ba1
...
...
@@ -2,12 +2,15 @@ package demo
import
(
"github.com/kataras/iris"
"github.com/kataras/iris/context"
"github.com/peterq/pan-light/server/demo/rpc"
)
func
Init
(
router
iris
.
Party
,
conf
map
[
interface
{}]
interface
{})
{
// 静态页
router
.
StaticWeb
(
"/"
,
"./static/demo"
)
router
.
Get
(
"/"
,
func
(
context
context
.
Context
)
{
context
.
Redirect
(
"/demo/init.html"
)
})
hosts
:=
map
[
string
]
string
{}
for
_
,
host
:=
range
conf
[
"hosts"
]
.
([]
interface
{})
{
hosts
[
host
.
(
map
[
interface
{}]
interface
{})[
"name"
]
.
(
string
)]
=
host
.
(
map
[
interface
{}]
interface
{})[
"password"
]
.
(
string
)
...
...
server/pan-light-server.go
浏览文件 @
cab15ba1
...
...
@@ -2,7 +2,6 @@ package main
import
(
"github.com/kataras/iris"
"github.com/kataras/iris/context"
"github.com/peterq/pan-light/server/artisan"
"github.com/peterq/pan-light/server/demo"
"github.com/peterq/pan-light/server/pc-api"
...
...
@@ -13,10 +12,6 @@ import (
func
main
()
{
log
.
SetFlags
(
log
.
LstdFlags
|
log
.
Lshortfile
)
app
:=
artisan
.
NewApp
()
//app.Get("/", func(ctx context.Context) {
// ctx.Write([]byte("Hello pan-light"))
//})
app
.
Get
(
"/"
,
func
(
ctx
context
.
Context
)
{})
cnf
,
ok
:=
os
.
LookupEnv
(
"pan_light_server_conf"
)
if
!
ok
{
...
...
@@ -28,5 +23,5 @@ func main() {
app
.
Use
(
artisan
.
ApiRecover
)
app
.
StaticWeb
(
"/"
,
"./static"
)
pc_api
.
Init
(
app
)
app
.
Run
(
iris
.
Addr
(
"
127.0.0.1
:8081"
))
app
.
Run
(
iris
.
Addr
(
":8081"
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录