Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ivan Tashkinov
pleroma
Commits
f3915e6e
Commit
f3915e6e
authored
7 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Basic SSH daemon.
parent
1712c93f
Branches
websocket-streaming
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pleroma/bbs/bbs.ex
+34
-0
34 additions, 0 deletions
lib/pleroma/bbs/bbs.ex
with
34 additions
and
0 deletions
lib/pleroma/bbs/bbs.ex
0 → 100644
+
34
−
0
View file @
f3915e6e
defmodule
Pleroma
.
BBS
do
def
start_daemon
do
:ok
=
:ssh
.
start
()
options
=
[
system_dir:
'ssh_keys'
,
auth_method_kb_interactive_data:
fn
(
_
,
user
,
_
)
->
{
'Welcome to Pleroma BBS'
,
'Hello
#{
user
}
'
,
'Password: '
,
false
}
end
,
auth_methods:
'keyboard-interactive,password'
,
pwdfun:
fn
(
user
,
password
)
->
true
end
,
shell:
&
start_prompt
/
1
]
:ssh
.
daemon
(
13121
,
options
)
end
def
start_prompt
(
user
)
do
spawn
(
__MODULE__
,
:prompt
,
[
user
])
end
def
prompt
(
user
)
do
IO
.
puts
(
"Hey
#{
user
}
.
\n
"
)
IO
.
puts
(
"Here's your timeline:
\n
"
)
user
=
Pleroma
.
User
.
get_cached_by_nickname
(
to_string
(
user
))
Pleroma
.
Web
.
TwitterAPI
.
TwitterAPI
.
fetch_friend_statuses
(
user
)
|>
Enum
.
each
(
fn
(
status
)
->
IO
.
puts
(
"
#{
status
[
"user"
][
"name"
]
}
(
#{
status
[
"user"
][
"screen_name"
]
}
):
#{
status
[
"text"
]
}
"
)
end
)
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment